View Single Post
Old 09-26-07, 04:41 PM   #120
uOpt
FreeBSD cheering section
 
uOpt's Avatar
 
Join Date: Nov 2004
Location: Boston, MA, USA
Posts: 609
Default Re: Languages you know

Quote:
Originally Posted by rhink
A lot of the perceived bloat comes from craptacular GUI API's like swing. And memory usage isn't a huge deal anyways, unless you're in an embedded environment, how much does another gig of ram cost anyways?
And I put in the 5th gig of RAM into my socket 939 box or the 9th GB of RAM into my socket 775 box - how?

Quote:
Originally Posted by rhink

It's certainly possible to write Java applications that aren't massive memory hogs... some of it comes from lazy programming style, people that are unfamiliar with pointers (and everything in java is a damn pointer, except primitives) and memory management (they like to tell you java takes care of this itself, but that sort of thinking breeds memory leaks because you figure the GC has it and you don't null pointers when you're done with them so the GC can clean them up, or never free up a listener, crap like that).
Sure, but the problem is that many Java libraries, and not only Swing and not only GUI libraries feel free to breathe a whole lot and waste memory on a grand scale. Then there's the JVM coming in on top and doing JIT which isn't exactly stealthy either.

Also, down to the metal - Java does not have arrays of instances of your user-defined structs. So if you want that you can either take the hit (and the hit can be big on a 64 bit system because the pointer in the array is 64 bits when the fields in your data structure might only be 32 combined).

Or you take the abstraction hit and open-code, use arrays of base data types instead of compound own data structures. That's what most of these useless language benchmarks do that end up showing Java is on par with C++. But in practice this is a nightmare. Worst of all, since Java have neither a macro system nor real generic programming you have no syntactic method at all to hide some of these optimizations.

So in practice people just take the memory hit, along with the pointer indirection hit. And Java programs are slow, only language benchmarks are fast for Java.
__________________

My Unix benchmark results
uOpt is offline   Reply With Quote