Re: fun with Java
Brian Burton <[email protected]> Wed, 16 Nov 2005 15:44:56 -0500
| Newsgroups | gmane.mail.spam.spamprobe.general |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Matthias B. wrote: > Was the bytecode program compiled by GCJ, too? What about if you compile > it with Sun's javac? Any difference? The native program was generated by compiling the java source code with GCJ using -O4 optimization. The bytecode executed by Sun's VM was generated by compiling with Sun's javac using -O optimization. I think at least part of the problem with hotspot may be the internal representation of strings. I noticed that even eliminating the tokenization step and just reading the messages from the mbox file into memory one at a time (i.e. each message loaded into memory in its entirety then discarded) caused the Sun VM to use a ton of memory. It was also interesting to watch the resident set size fluctuate in top. With spamprobe and the GCJ compiled version the RSS did change much (maybe 10% or so) once it hit its average value. With the Sun VM OTOH the RSS fluctuated wildly from 40-400 MB! Of course top is a very course grained way of watching memory usage but the runs were very consistent. It appears that the Boehm garbage collector used by GCJ puts a much smaller hit on the processor cache than the collector in hotspot. Overall I think gcj is pretty great and I'd very much like to explore compiling some of my existing java programs with it. I think my CoffeeLink nntp server would see a big benefit from deployment as native code. I just don't think it's a good alternative to the C++ code base for a tool like spamprobe that needs to run frequently and simultaneously under many user accounts. I was really hoping to see compiled java running within 80% or so of compiled C++ code so I could have the productivity benefits of java without much of a performance hit. I'd have danced around the room if native java had been faster. :-) Now I'm thinking of porting over some of the code in CoffeeLink into spamprobe. I have some nice code for config files there and even a little b-tree package that I'm anxious to run side by side with BDB/PBL to see how it compares. It's probably slower but it has full transaction semantics which can be nice for something like spamprobe to avoid database corruption in the event of a system crash. I'm starting to think that a multi-user persistent daemon version of SP might be worth having too. It could talk to a SQL database and keep enough info in the database to make periodic training updates faster (i.e. store lists of messages and their tokens in the database to avoid having to reparse them). All the best, ++Brian -----BEGIN PGP SIGNATURE----- Version: PGP Desktop 9.0.2 (Build 2425) iQEVAwUBQ3uaTjxRyEoJfXIFAQg0rAf/Tu75mFAfFVFydJpdrFNUQrjh9KTb5Cj7 z3fF54E9wZVmBUcz7DLCEHA7qWImvnm7uUmJAL7kwmzAnyAMBCNiGAz+Itw+XufS B8lYMQOaQaDUGw8abQatQjzcfbMLYJqPyAaFGgFbVmDtEQQ6BClppNuCaBHGgWch lcyK9V+mwy5mFSuRbChGlJ/ybRBvGi/nDzsxIJHX9zK6CrYVMrG+GFv0Yxg7G7cM O7SJmVMyClUOx/6Q7CDyAxMhf/K14PaRh5nDAOrV7JGU6OXNgh0Ifi+QE6+lbMFj hfxFsXUiZDFyTTt37CZS8hNWXyEvaR+FrhL6VOqfn1sS7kDEdQ1nHA== =DDKw -----END PGP SIGNATURE----- ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click