[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ubuntu-devel-discuss
Subject:    Space optimisations: OpenJDK runtime .jar
From:       louis.simard () gmail ! com (Louis Simard)
Date:       2010-11-06 23:24:05
Message-ID: AANLkTi=m5aEjPGwZvZxcPgAyg=-d3tbnJPPFBb_3kZZT () mail ! gmail ! com
[Download RAW message or body]

Matthias,

In a posting from 'More LiveCD space optimizations' [1], you asked if
the Java VM would open recompressed .jar files as quickly as the
originals. I wrote a benchmark to assess this, by using the largest
.jar there is: the Java library itself! :)

I've split off this benchmark result to its own e-mail thread because
Java is not on the LiveCD, and it has more of a special interest to
folks running servers. But it's still a space optimisation.

Attached is a benchmark program; please download it if you want to
reproduce this benchmark on your machine.

* * * EXECUTIVE SUMMARY  * * *

In the OpenJDK package, most of the Java class library is implemented
as a single file, rt.jar, and that file is uncompressed. Compressing
it with 'advzip -z4 rt.jar' saves 32,184 KiB out of 60,064 KiB
(53.5%).

The speed regressed by 32 milliseconds (16%) to load 894 classes from
the Java library. I believe this number to be representative of the
number of classes loaded by an application server such as JBoss or
GlassFish.

* * * END OF EXECUTIVE SUMMARY * * *

-- Preparing for the benchmark --

sudo apt-get install openjdk-6-jre advancecomp
cp /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar rt.jar; sync
cp rt.jar rt-recompressed.jar
advzip -z4 rt-recompressed.jar

# [At this stage, rt.jar is 60064 KiB and rt-recompressed.jar is 27880 KiB]
# Make sure you've downloaded the attachment and saved it to
$PWD/ClassLoadTest.java.gz
# before running the rest.

gunzip ClassLoadTest.java.gz && javac -g:none -source 1.6 -target 1.6
ClassLoadTest.java
for i in `seq 1 10`; do java ClassLoadTest; done
sudo cp rt-recompressed.jar /usr/lib/jvm/java-6-openjdk/jre/
for i in `seq 1 10`; do java ClassLoadTest; done

# Cleanup
sudo cp rt.jar /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar
rm ClassLoadTest.java ClassLoadTest.class rt.jar rt-recompressed.jar; sync

-- Methodology --

I ran this test on a computer that has 4 GB of RAM and a dual-core 2.6
GHz AMD processor set to 2.6 GHz with the Performance frequency
selector. This test does not use threads, so it would be run at 2600
MIPS.

The Java program outputs the number of nanoseconds it takes the Java
VM to load all of the classes named in the 'loads' variable and all of
their dependencies (to see the number of classes loaded, use 'java
-XX:+TraceClassLoading ClassLoadTest | grep Loaded | wc -l'). For the
results below, I have removed the fastest and the slowest run before
calculating the average time.

-- Results --

Original rt.jar, nanoseconds: 192534058, 197527724, 194842272,
196013535, 188327043 [fastest], 191867030, 200329576, 202827722
[slowest], 195906590, 199961018

Recompressed rt.jar, nanoseconds: 208085265 [fastest], 230182021,
218891572, 221611904, 231577539, 232149021, 228110533, 230476584,
232480308 [slowest], 229873766

Original rt.jar: 196 milliseconds
Recompressed rt.jar: 228 milliseconds

Speed regressed by 32 milliseconds (16%) to load 894 classes.

[1] https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2010-October/012183.html
--
Louis Simard
<Conspicuous absence of digital signature here>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ClassLoadTest.java.gz
Type: application/x-gzip
Size: 2460 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20101106/9466ee3b/attachment.bin \



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic