Jan Filipsky

Greenhorn
+ Follow
since Aug 20, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jan Filipsky

Hello,
we use our own preprocessing tool which uses this technique:
- comments out all system.out.print... and system.err.print...
- finds all public static final variables and converts them into C-like header file eg constants.h (eg #define MILLIS_PER_TICK 100)
- at the top of each .java file it processes it adds #inculude constants.h

then it calls c preprocessor, which replaces all these "constants" with their values.

This technique decreases the resulting JAR size by cca 10%

The reason is that public static final variables are stored in classes in so called constant pool (and that consumes space) and accessing them is also expensive - there is an opcode "get constant nr x from the pool"

On the other hand when you (or preprocessor) use a value (eg. 10) there is only an opcode "use 10"

Sorry for my english, hope it helped
[ August 20, 2004: Message edited by: Jan Filipsky ]
19 years ago