Regarding point 2, saw a reference to the following article on Slashdot today claiming java.io to be faster than java.nio: http://developers.slashdot.org/story/10/07/27/1925209/Java-IO-Faster-Than-NIO Don't have much experience with NIO and I've never been in a position of having to optimize every last bit out of an IO algorithm, so not sure quite what to make of this.
Alexey ________________________________ From: Christian Catchpole <[email protected]> To: The Java Posse <[email protected]> Sent: Wed, July 28, 2010 6:18:39 AM Subject: [The Java Posse] Re: Fastest way to parse data out of array of bytes? I'v been avoiding this thread because I know that as much as I know I know about optimisation and the JIT I know there is probably more that I don't know. 1. regardless of how fast the fasterReadInt32 method works on a particular JVM, what is the ratio of this to the time spent operating on that data? 2. if the read time really matters and you are moving lots of chunks of memory around, look at NIO / Buffers. 3. yes, java can use more memory than a program is C++ can theoretically use. but there are many many reasons you use a VM for enterprise / server applications. so if performance matters that much, optimise your C++ or assembler and welcome to a world of spending 10 times as much time getting the same stuff done (and then not sleeping at night wondering if your server has come down with a general protection fault) 4. having said that, VMs just get better and better and you don't have to lift a finger (other than installing a new one). 5. as Casper mentions, there are some things that are suited to pre- compiled code. I'm thinking things like media codecs and compression algorithms as they seem to work on fixed, pre-allocated memory blocks. and they can be "fail proof" as well (no out of memory) and somewhat time predictable. but business applications have large, complex and dynamic object models with lots of strings, lists, maps blah blah blah. In this case, go the JVM. 6. Using "java" on the command line to start Eclipse may have used a bunch of defaults that were not suitable. Max memory the obvious one. So despite how much coolness is in the JVM, we still have the defaults that bring things undone from the consumers point of view. 7. A "linux" friend of mine doesn't like Java because a "Hello World" uses so much memory... My response: Duh! -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en. -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
