A little project i have, trying to reduce the size of a Java Class file.
Without removing any features.
Original Size:
5736bytesCurrent reduction:
3150bytes removed (~55% reduction) (Pure javac compile, no compression or proguard)
With Proguard(class only):
3219bytes removed (~56% reduction)
Compressed Jar:
4219bytes removed (~73% reduction)
Compressed Proguard Jar:
4304bytes removed (~75% reduction)
NOTES:Rolling your own builder in eclipse pays off, got a ~550b reduced class file size

Fell free to leave any comments/tips which can help in my quest
Source Code:Final -
http://pastebin.java-gaming.org/311b3907443v1.4 -
http://pastebin.java-gaming.org/e905a337341v1.3 -
http://pastebin.java-gaming.org/9e9052a7343v1.2 -
http://pastebin.java-gaming.org/19e90157a43v1.1 -
http://pastebin.java-gaming.org/619e900754av1.0 -
http://pastebin.java-gaming.org/4619e996045 - This is not the first version, it's the first version i had access to.
I kept a little changelog: (Number prefixes are class sizes in bytes)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Prefix = bytes
5736 First
5712 Changed .76f to .75f 5707 Chaged wall/roof/floor size to 50 instead of 1000 5693 .. Some random shit (but it still works) 5687 .. Some random shit (but it still works) 5449 Removed debugging(box pos) 5330 Removed boolean isAlive and changed to !Display.isCloseRequested 5169 Shortened some variable names 5096 Removed unnecessary code. 4984 Removed unnecessary code. 4708 Reusing variables 4640 Reusing variables 4638 Shortened Variable name 4610 Changed !Display.isCloseRequested() to !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) 4609 Removed unnecessary code. 4603 Changed some floats to ints 4055 Reused some variables FixtureDef, BodyDef & PolygonShape (used .clone()) 3882 Removed unnecessary code. 3855 Removed unnecessary code. 3653 Removed unnecessary code. 3598 Changed Math.toDegrees() to Radian * (180 / 3.1415) 3547 Changed getContactList() to b.getPosition().y < .77f 3518 Removed unnecessary code. 3363 Reused some variables. 3339 Removed unnecessary code. 3275 Various fixes. 3238 Removed glDisable(GL_DEPTH_TEST) as it was never enabled by glEnable() 2683 Implemented custom builder into Eclipse. psuedo cmd: javac -cp "PROJECT_CP" -g:none SOURCE_FILE -d OUT_FOLDER 2586 Removed unnecessary code and various fixes. |