[javaCompiler-users] one more feature request :)
Status: Beta
Brought to you by:
soapy
From: john s. <kmk...@ya...> - 2006-09-06 17:19:44
|
"john sonal wrote: > I have one more feature request... > > -> Add an optimization option. To do this you just > pass -O2 after each compile command. ie. gcj -c > blah.jar -O2 Crap. I looked that up, but it didn't seem to exist; so I didn't use it. Either I screw that up or it just wasn't there with GCJ 3.x. Thanks, I'll add that. > It usually makes a difference in binary size (smaller) Really? I have different experience. As higher the optimisation, as bigger the executables... Depends on the strengh of the optimisation. Anyway, it doesn't make big changes :-) What we really need is the ability to remove AWT/Swing and XML from the binaries when not needed. That would drastically reduce the binary size... > and makes a big difference in performance. Yes, -O2 should really have been there... Marco" I wasn't sure if it existed either for gcj but then I manually compiled a program and it accepted the flag. Right away I noticed the optimized binary was 2 mb less than the non optimized one. The optimized binary also performs nearly 300% quicker in parsing a 25k xml document (from 1205 ms to 430ms). About optimization and the binary size. According to gcc's site: "-O2: Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff." Based on that it would seem that binary size should not increase but if it does, only slightly. I had read somewhere else that -O2 usually shrinks the binary. -O3 on the other hand will make it bigger. There's also -Os which might be the best solution to use with GCJ: "Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size." I haven't tried -Os yet. I'll do that today and see how much of a difference in binary size it makes. I think it would be nice to remove the xml stuff from the binary in all situations since most people will typically want to use their own xml parser. As far as the AWT/Swing stuff, I believe what that guy at thisiscool.com did was to compile different versions of "libgcj". One with Swing/AWT stripped out and one with that "SwingWT" library included. Here's a quote from his site: "To integrate SwingWT, I first surgically removed the GNU AWT and Swing sources from the libgcj build (see noawt.diff in the patch list below)." Not sure how difficult it would be to do that. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |