Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Class optimizer  (Read 2786 times)
0 Members and 1 Guest are viewing this topic.
Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Posted 2003-02-09 11:09:51 »

I know there's many small programs on the net for optimizing java class files, like this one :

http://www.uni-vologda.ac.ru/~c3c/jco/

So I would like to have some comments about these softwares and know which software is the best for reducing class size.

Anyone ?

++
Chman
Offline Mamoulian

Senior Newbie





« Reply #1 - Posted 2003-02-11 14:53:52 »

Here http://www.geocities.com/marcoschmidt.geo/java-class-file-optimizers.html is an overview about class optimzing / obfuscating tools. Personally I tried jopt. I could not really determine any performance improvements. The classes were crunched a bit, in average I would say about 20%.

The ofuscating effect was fine so far to make class file debugging harder but by far not impossible.
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #2 - Posted 2003-02-11 15:26:29 »

i've used jax6.0 & jax7.3 in the past (for J2ME game development, and a 4k game contest), class size depends very much on the code, but you should expect around a 20-40% reduction in class size.

As 2 speed increase, i'd say its pretty negligable. (except in very extreme circumstances)

p.s. jax is abit out of date now (IBM hasn't updated it in quite a while) it only supports java1.3 and below.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Reply #3 - Posted 2003-02-12 10:08:52 »

thanks fos answers...
so class optimizer are only useful for reducing class size...

++
Chman
Offline leknor

Junior Devvie




ROCK!!!


« Reply #4 - Posted 2003-02-12 10:37:47 »

Quote
so class optimizer are only useful for reducing class size...
Pretty much, an "optimizer" can't do much useful performance wise. Most real optimization is done by the JIT at run time. You'll get the most optimization from improving your algorithms.

As for class size an optimizer can strip the debugging info out if you forgot to. Also it can rename private methods and fields, the method name takes up bytecode space, so limiting visibility can help.

Also, when jar'ing the files make sure compression is on, usually is, and you may be able to save a few bytes by including your own manifest instead of the default. Also, recompressing with a zip tool like WinZip with maximal compression enabled may help. I haven't tried the previous ideas so no guarentees.
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #5 - Posted 2003-02-12 18:22:20 »

Yup, jar.exe that comes with the jdk gives pretty abysmal compression. For best results I would recommend using 7-zip rather than Winzip.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline zulo

Junior Devvie




Java games rock!


« Reply #6 - Posted 2003-02-22 20:01:56 »

When you use winzip or 7-zip to make jar files,do you just make a normal zip then rename it to .jar?
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #7 - Posted 2003-02-22 21:33:37 »

Quote
When you use winzip or 7-zip to make jar files,do you just make a normal zip then rename it to .jar?


yes. zip and jar is the same (just a different file extension)

btw i use jarg... it's compression seems to be a bit better than 7-zip's or winzip's (in most cases). btw jarg is an obfuscator wich "eats" jar files directly (as u might have guessed - the output is a jar file too).

jarg can be found at sourceforge btw Wink

jax and jarg seems to be a good combo Smiley

弾幕 ☆ @mahonnaiseblog
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #8 - Posted 2003-02-23 14:48:15 »

Quote


jax and jarg seems to be a good combo Smiley


I second that - jarg manages to do even more optimisations than jax Shocked
(though I find 7zip creates smaller zips than jarg Roll Eyes)

my compilation process is.

javac->jax->jarg->7zip

btw,
does any1 know if 7zip can be setup to execute from the cmdline? (with 98 not 2k Sad)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #9 - Posted 2003-02-23 21:50:36 »

Quote

(though I find 7zip creates smaller zips than jarg Roll Eyes)

depends Tongue

Quote
does any1 know if 7zip can be setup to execute from the cmdline? (with 98 not 2k Sad)


yea 7zip can be used from the cmdline... well the syntax is a pain in the arse (check "7-zip.chm" for details).

add it's directory to your path variable (autoexec.bat)
1  
2  
3  
4  
//before
SET PATH=C:\j2sdk1~1.1_0\BIN;C:\BORLAND\BCC55\BIN;%PATH%
//after
SET PATH=C:\j2sdk1~1.1_0\BIN;C:\BORLAND\BCC55\BIN;C:\PROGS\7ZIP;%PATH%


after reboot or starting the bat manually u can run the 7z.exe (cmd line version) from every directory.

well... u don't have to add it to your path variable if u just want to call it from bat files.

1  
"C:\Progs\7zip\7z.exe" a -tzip test.zip -mx a.class readme.txt


a=add
-tzip=use zip compression
test.zip=put it into "test.zip"
-mx=max compression
a.class=a file i would like to add
readme.txt=another file i would like to add

in theory u can even compress a bit better than the default "max compression" default does. if u set fastbits to 255 (fb=255) and passes to 4 (pass=4).

[the default "max" uses fb=64 and pass=3]

well... in reality it seems to make no difference. i tried it with a lot of different files and it was always as big/small as the default max compression preset. but i think there are some files where it would make a difference Smiley

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #10 - Posted 2003-02-24 19:21:07 »

cool Cheesy

if it saves me '135 bytes', consider the favour returned Grin

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline coilcore

Senior Newbie




Java games rock!


« Reply #11 - Posted 2003-03-18 23:03:26 »

Functionally zip and jar are the same but there are some minor differences to note.  

1.  Both use zlib and make more or less the same kind of files.  However if you want to retain cross platform portability you need to take care in making permutations to the compression.  Not all platforms come with the same ability to decompress more dense compression formats.  Jar uses fairly conservative compression to maintain cross platform portability.

2.  Minor point but jar by default adds a /META-INF and manifest file.  
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!