<?xml version="1.0"?>
<rss version="2.0.">
  <channel>
    <title>Advogato blog for tan</title>
    <link>http://www.advogato.org/person/tan/</link>
    <description>Advogato blog for tan</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Wed, 9 Jul 2008 07:37:45 GMT</pubDate>
    <item>
      <pubDate>Wed, 9 Apr 2008 21:11:56 GMT</pubDate>
      <title>9 Apr 2008</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=8</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=8</guid>
      <description>&lt;b&gt;Some Good ol' Benchmarking&lt;/b&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.advogato.org/person/tromey/" &gt;Tom&#xD;
Tromey&lt;/a&gt; just posted on the gcj mailing-list a link to an&#xD;
interesting Java to C &lt;a href="http://www.stefankrause.net/wp/?p=6" &gt;benchmark&lt;/a&gt;.&#xD;
It's actually a followup to a &lt;a href="http://www.stefankrause.net/wp/?p=4" &gt;previous one&lt;/a&gt;,&#xD;
to which other Java runtimes have been added.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;Basically, that's a comparison of micro-benchmarks&#xD;
between some "classical" (JITed) Java environments, compiled&#xD;
ones (GCJ and JET) and the equivalent C programs.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;As I understand it, the results show that comparing Java&#xD;
to C performance-wise does not have much meaning. Depending&#xD;
on the task at hand, Java timings are in a +30% to -30%&#xD;
interval with respect to C performances.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;If such a worn-out subject interest you, I would recommend&#xD;
reading the classical "&lt;a href="http://page.mi.fu-berlin.de/~prechelt/Biblio/jccpprt_computer2000.pdf" &gt;An&#xD;
empirical comparison of C, C++, Java, Perl, Python, Rexx,&#xD;
and Tcl&lt;/a&gt;". I suppose some &lt;a href="http://shootout.alioth.debian.org" &gt;shootout&lt;/a&gt;&#xD;
results would be a nice read too (their &lt;a href="http://shootout.alioth.debian.org/gp4/faq.php" &gt;FAQ&lt;/a&gt;&#xD;
 is a must-read). Oh, look, there's even a detailed &lt;a href="http://en.wikipedia.org/wiki/Comparison_of_programming_languages" &gt;wikipedia&#xD;
page&lt;/a&gt; about languages comparison.&#xD;
&#xD;
&lt;p&gt; &lt;b&gt;My Dream Language&lt;/b&gt;&#xD;
&lt;p&gt;I'm actually more interested, as stated in my previous&#xD;
post, by what may or may not help a library to gain&#xD;
acceptance. Execution time of "scripted" or VM-based&#xD;
languages is a typical FUD; runtime memory usage is more of&#xD;
a concern (especially when compiling to native). Linking to&#xD;
other languages is probably what&#xD;
matters more, actually. That's the only argument I could&#xD;
imagine in favor of C.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;For application writing, it's clear to me that using a&#xD;
garbare-collected, multi-paradigms language (especially with&#xD;
a rich functional expressiveness) is a no-brainer, from a&#xD;
productivity and maintainability point of view. But for&#xD;
maximum reuse, what's needed is multiple, clearly-defined&#xD;
libraries. For which I'm afraid no perfect implementation&#xD;
environment exists.&lt;p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;I would love the above high-level characteristics (which&#xD;
rules out C, C++ and to a lesser extend Java), easy linking&#xD;
with existing C libraries (that one is OK with most&#xD;
languages), and natural, efficient reuse from other popular&#xD;
languages and environments (Java, C#, C++, Python and PHP&#xD;
easily come to mind).&#xD;
&#xD;
&lt;p&gt; &lt;b&gt;Now I'm getting Boring&lt;/b&gt;&#xD;
&lt;p&gt;Ahh, the good old Graal of universal, transparent &lt;a href="http://en.wikipedia.org/wiki/Software_componentry" &gt;componentry&lt;/a&gt;...&#xD;
Perhaps some agnostic glue is needed... CORBA failed us, Web&#xD;
Services are overkill to fit together applicative&#xD;
components... Wouldn't &lt;a href="http://www.freedesktop.org/wiki/Software/dbus" &gt;D-BUS&lt;/a&gt;&#xD;
be more interesting in this case (but calls granularity&#xD;
should be properly thought out)?&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;So which paradigm/language/framework could provide us&#xD;
with some kind&#xD;
of universal "software mashup"? Any opinion (or better,&#xD;
bibliography) on this matter, which I feel is quite the&#xD;
opposite of a language&#xD;
comparison (would you fear the trolling)? Am I getting&#xD;
boring? :-)&#xD;
&#xD;
&lt;p&gt; &lt;b&gt;If You're still with me&lt;/b&gt;&#xD;
&lt;p&gt;In (not so) other news, I noticed a revised edition of&#xD;
the &lt;a href="http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools" &gt;Dragon&#xD;
Book&lt;/a&gt; was available. Among the new topics are better&#xD;
code analyze and optimization, JIT compiling, garbage&#xD;
collecting... I&#xD;
need this (&lt;a href="http://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1207774805&amp;sr=1-1" &gt;pricy&lt;/a&gt;)&#xD;
beast!&lt;p&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 7 Apr 2008 23:16:39 GMT</pubDate>
      <title>7 Apr 2008</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=7</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=7</guid>
      <description>Hi all,&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;I've been toying with the idea of implementing some&#xD;
networking protocol stuff for some time now. That was&#xD;
actually one of my motivations for working with native&#xD;
compilation of Java code to Win32 platform, but that proved&#xD;
disappointing. J2SE has a big, tightly coupled runtime /&#xD;
libraries set, and it seems difficult to produce lean and&#xD;
mean binaries out of it (that's my current experience&#xD;
anyway).&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;In the mean time since my last post on this matter, more&#xD;
than a year and a half ago, I gradually understood Java was&#xD;
not the weapon of choice for small, nicely desktop&#xD;
integrated tools (please disprove me!). It can be done, but&#xD;
I feel it goes against Java basic design decisions, which&#xD;
mean you're then kind of fighting against your platform.&#xD;
Productivity killer. Baaad.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;So I'm kind of confused. What I want to do is some&#xD;
networking code. I will develop it as one or some libraries,&#xD;
and build some apps above it, since I feel there's nothing&#xD;
sadder that a great idea intermixed with some application&#xD;
code (at the end of the day, if someone want to reuse it,&#xD;
he'll spend a hell of a time figuring out which parts he&#xD;
actually needs).&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;The apps will be coded in a nice, productive language (I&#xD;
lean toward Python, or perhaps something more exotic to me&#xD;
like &lt;a href="http://factorcode.org" &gt;Factor&lt;/a&gt;).&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;The libraries would be coded under an LGPL or BSD license,&#xD;
for best reuse; but which language would you choose?&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;I can use some nice, high-level language; but I do not&#xD;
want to restrict reuse opportunities with the age-old "how&#xD;
sad this is coded in X when I'm coding in Y, I'll have to&#xD;
port/rewrite it".&#xD;
&lt;li&gt;I could code it using C, and provide bindings for some&#xD;
higher-level languages (which, I suppose, excludes C++ from&#xD;
the loop, as it's more difficult to bind to anything else&#xD;
than C). But as good as this is from a reuse point of view,&#xD;
and even if I'm a capable C coder, that is definitively a&#xD;
productivity killer and a sad jump in the past (no offence&#xD;
intended to enthusiast C coders, but I'm kind of accustomed&#xD;
to OOP,&#xD;
generics and automatic memory management now).&#xD;
&lt;/ul&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;There's no win/win solution here, I'm afraid. So I'd like to&#xD;
get your opinion on this matter of maximum reuse /&#xD;
acceptation of a library, at the cost of language&#xD;
expressiveness.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;On a related note: should I code in C, I'd prefer to use&#xD;
a portable foundation&#xD;
library since I'd like to target at least the linux and&#xD;
Win32 platform. It would be that less low-level details&#xD;
to bother with. It seems like the &lt;a href="http://apr.apache.org/" &gt;Apache Portable Runtime&lt;/a&gt; is&#xD;
a good candidate. Does it provide an &lt;a href="http://java.sun.com/j2se/1.4.2/docs/guide/nio/" &gt;NIO&lt;/a&gt;/select-like&#xD;
abstraction (event-driven networking)? Are there other&#xD;
similar platform-abstraction toolkits you could hint me to?&#xD;
&#xD;
&lt;p&gt; Regards.</description>
    </item>
    <item>
      <pubDate>Sat, 19 Aug 2006 20:53:44 GMT</pubDate>
      <title>19 Aug 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=6</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=6</guid>
      <description>&lt;a href="http://www.advogato.org/person/rmathew/" &gt;rmathew&lt;/a&gt; proposed a patch following our discussion. It solved my &lt;a href="http://gcc.gnu.org/ml/java/2006-08/msg00048.html" &gt;SWT crashing issue&lt;/a&gt; and &lt;a href="http://gcc.gnu.org/ml/java-patches/2006-q3/msg00338.html" &gt;made its way&lt;/a&gt; to gcc trunk. Helping fixing this bug was a rather enjoyable experience, and remembered me how much I liked assembly language and low-level issues.

&lt;p&gt; Anyway, a canonical SWT "HelloWorld" now works properly, as well as the tray variation I've &lt;a href="http://www.advogato.org/person/tan/diary.html?start=0" &gt;initially chosen&lt;/a&gt; as a simple example.

&lt;p&gt; Now that this code compiles and runs properly, I'm focusing on its packaging. &lt;a href="http://nsis.sourceforge.net/" &gt;NSIS&lt;/a&gt; seems like an obvious choice, but I'd first like to "clean" my compiled app.

&lt;p&gt; Indeed, I'm kind of surprised by its size; this basic example weights 52MB. Stripping it and compressing it with the excellent &lt;a href="http://upx.sourceforge.net/" &gt;UPX&lt;/a&gt; leads to a 4MB executable, but it still does feel like an awful lot. Perhaps some code analysis could remove unneeded parts? I'll have to goggle about this.</description>
    </item>
    <item>
      <pubDate>Thu, 17 Aug 2006 20:08:11 GMT</pubDate>
      <title>17 Aug 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=5</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=5</guid>
      <description>Following &lt;a href="http://www.advogato.org/person/rmathew/" &gt;rmathew&lt;/a&gt;'s &lt;a href="http://gcc.gnu.org/ml/java/2006-08/msg00062.html" &gt;advice&lt;/a&gt;, I looked for a cl.exe (the Win32 compiler) flag equivalent to gcj's -fno-omit-frame-pointer. Which actually &lt;a href="http://msdn2.microsoft.com/en-us/library/2kxx5t2c.aspx" &gt;exists&lt;/a&gt;.

&lt;p&gt; I then had a &lt;a href="http://gcc.gnu.org/ml/java/2006-08/msg00065.html" &gt;fun little time&lt;/a&gt; disassembling the resulting library to ensure this flag had the desired effect (I used &lt;a href="http://www.backerstreet.com/rec/recdload.htm" &gt;REC&lt;/a&gt; for this purpose, a nice but sadly not open-sourced software).

&lt;p&gt; Well, it did, but this did not solve my crashing issues. At this point, it seems like I really should study and trace gcj's stack unwinding code...</description>
    </item>
    <item>
      <pubDate>Wed, 16 Aug 2006 19:28:16 GMT</pubDate>
      <title>16 Aug 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=4</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=4</guid>
      <description>The gcj mailing-list (and, more specifically, Ranjit Mathew, the author of the scripts I used to build a Win32 gcj) helped me; I'm not sure I liked &lt;a href="http://gcc.gnu.org/ml/java/2006-08/msg00053.html" &gt;the answer&lt;/a&gt;, though...

&lt;p&gt; So I need to build an SWT DLL using a specific flag (-fno-omit-frame-pointer). Otherwise, the unwinding code (whatever kind of stack-walking thingy that may be) get confused.

&lt;p&gt; I've actually been able to build a working DLL, but I had to use the standard Windows toolchain (which, surprisingly to me, I could download for free). Adapting those makefiles to gcj will be an &lt;i&gt;interesting&lt;/i&gt; exercise...

&lt;p&gt; I'd never thought my desire to integrate open source java software to Windows would lead me to the installation and fiddling with of so much Microsoft tools...</description>
    </item>
    <item>
      <pubDate>Mon, 14 Aug 2006 13:26:00 GMT</pubDate>
      <title>14 Aug 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=3</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=3</guid>
      <description>So the gcj toolchain seems to be properly compiled under Windows. And I've been able to compile and run a simple hello world.

&lt;p&gt; After some hesitations, I've also compiled and linked simple SWT code, which is my &lt;a hef="http://www.advogato.org/person/tan/diary.html?start=0" &gt;main goal&lt;/a&gt; for now. Sadly, this dies when setting up SWT Display. gdb only revealed some arcade parts of stacktraces handling in libjava; nothing I can debug myself for now.

&lt;p&gt; Since I don't know how to handle this, I posted a &lt;a href="http://gcc.gnu.org/ml/java/2006-08/msg00048.html" &gt;message&lt;/a&gt;  to gcc's java list. I've registered to it when I started playing with gcj; those people seem pretty reactive.</description>
    </item>
    <item>
      <pubDate>Fri, 11 Aug 2006 04:16:26 GMT</pubDate>
      <title>11 Aug 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=2</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=2</guid>
      <description>My discovery of the wonders of open-source java compilers continues, as I dig deeper in gcj mailing lists archives...

&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; So &lt;a href="http://groups.google.fr/group/linux.debian.maint.java/browse_thread/thread/79130320ccfebd09/5662e8813098f50c?lnk=st&amp;q=&amp;rnum=1&amp;#5662e8813098f50c" &gt;ecj does not compile to native code&lt;/a&gt;... I'll stick to gcj then.

&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; Actually, I packed together rmathew's &lt;a href="http://rmathew.com/articles/gcj/bldgcj.html" &gt;instructions&lt;/a&gt; in a shell script and after some fiddling, I've successfully built my first Windows gcj compiler yersterday!

&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; It's a priviledged moment: as I didn't have time to read the compilation logs and test the resulting binaries, I am not aware for now of any problem that may have happened :-)</description>
    </item>
    <item>
      <pubDate>Tue, 8 Aug 2006 04:44:04 GMT</pubDate>
      <title>8 Aug 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=1</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=1</guid>
      <description>In my study of the native java compilation ecosystem, I discovered an interesting compiler project, &lt;a href="http://gcc.gnu.org/wiki/GCJX" &gt;GCJX&lt;/a&gt;. &lt;i&gt;One of the goals of GCJX is to replace the current Java front-end in GCJ.&lt;/i&gt; Sounds nice.

&lt;p&gt; Then I discovered that its main developer, &lt;a href="http://tromey.com/blog/" &gt;Tom Tromey&lt;/a&gt;, is seriously &lt;a href="http://gcc.gnu.org/ml/gcc/2006-01/msg01034.html" &gt;reconsidering&lt;/a&gt;
his project. But in that same message, I learnt the existence of the &lt;a href="http://www-03.ibm.com/developerworks/blogs/page/Wayner?entry=did_you_know_that_eclipse" &gt;seemingly little-known&lt;/a&gt; Eclipse Java Compiler (ecj). Which looks nice from a &lt;a href="http://gcc.gnu.org/ml/java/2003-07/msg00201.html" &gt;performances&lt;/a&gt; point of view, but doesn't even &lt;a href="http://gcc.gnu.org/ml/gcc/2006-01/msg01090.html" &gt;answer to its name&lt;/a&gt;...

&lt;p&gt; Anyway. I kind of goofed around with &lt;a href="http://www.mingw.org/" &gt;MinGW/MSYS&lt;/a&gt;-based gcc compilation, without much luck for now. But I spent some time on &lt;a href="http://www.rmathew.com/articles/gcj/bldgcj.html" &gt;cross-native&lt;/a&gt; (or whatever it's called) compilation of a Windows gcc compiler under linux, and this looks very promising.

&lt;p&gt; Hum, the previous link doesn't seem up at all time; here is the &lt;a href="http://72.14.221.104/search?q=cache:c9hrLs1Iqj0J:rmathew.com/articles/gcj/bldgcj.html+&amp;hl=fr&amp;ct=clnk&amp;cd=1" &gt;goggle cache entry&lt;/a&gt;.
</description>
    </item>
    <item>
      <pubDate>Thu, 27 Jul 2006 21:53:20 GMT</pubDate>
      <title>27 Jul 2006</title>
      <link>http://www.advogato.org/person/tan/diary.html?start=0</link>
      <guid>http://www.advogato.org/person/tan/diary.html?start=0</guid>
      <description>First entry. Great.

&lt;p&gt; &lt;p&gt; &lt;p&gt;I feel that Java/SWT under Eclipse is a slick way to develop apps. But being able to share those apps with people without the hassles of JVM installation and kludgy integration would be great.

&lt;p&gt; &lt;p&gt; &lt;p&gt;Here enters native compilation. As a testbed, I'd like to compile a small SWT example demonstrating some nice native features (tray icons and tooltips) under Windows.

&lt;p&gt; &lt;p&gt; &lt;p&gt;For this test to be useful, it should be performed using open-source tools and a modern java environment version (1.4.2 at least, preferably 5.0 or whatever it's called today).

&lt;p&gt; &lt;p&gt; &lt;p&gt;&lt;a href="http://today.java.net/pub/a/today/2003/12/08/swing.html" &gt;Some&lt;/a&gt; &lt;a href="http://www-128.ibm.com/developerworks/library/j-native.html" &gt; documentation&lt;/a&gt; &lt;a href="http://www-128.ibm.com/developerworks/java/library/j-nativegui2/" &gt;exists&lt;/a&gt;, but I'd like to write some more up-to-date, no-fuss instructions.</description>
    </item>
  </channel>
</rss>
