• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class file size  RSS feed

 
PN Kumar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To what extent does the size of class file depend on the JVM used - i face a situation where in the size of class files compiled in two different environments(one in windows jdk141_05 and the other in Unix) vary significantly - each and every class has a size difference of about 10%.Could someone throw more light into this?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here's an output from an ls command run on the same Linux machine in 2 folders.
One contains classes compiled using 1.4.2_03 on Windows, the others classes built using ant running on the Linux machine which uses 1.4.1_02.
Windows compiler:

-rw-rw-rw- 1 nobody nobody 1156 Mar 30 07:47 OptionElement.class
-rw-rw-rw- 1 nobody nobody 41106 Mar 30 07:47 Order.class
-rw-rw-rw- 1 nobody nobody 25725 Mar 30 07:47 OrderRegel.class
-rw-rw-rw- 1 nobody nobody 8570 Mar 30 07:47 Prijzen.class
-rw-rw-rw- 1 nobody nobody 7540 Mar 30 07:47 PrinterSettings.class
-rw-rw-rw- 1 nobody nobody 2035 Mar 30 07:47 Rekening.class
drwxrwxrwx 5 nobody nobody 4096 Mar 30 07:47 relatiebeheer
-rw-rw-rw- 1 nobody nobody 3631 Mar 30 07:47 Relatie.class
-rw-rw-rw- 1 nobody nobody 5281 Mar 30 07:47 SelCri.class
-rw-rw-rw- 1 nobody nobody 5785 Mar 30 07:47 Selecties.class
drwxrwxrwx 2 nobody nobody 4096 Mar 30 07:47 servlets
-rw-rw-rw- 1 nobody nobody 1463 Mar 30 07:47 SKObegl.class
-rw-rw-rw- 1 nobody nobody 4370 Mar 30 07:47 SKO.class
-rw-rw-rw- 1 nobody nobody 1164 Mar 30 07:47 SKO$KillTimer.class
-rw-rw-rw- 1 nobody nobody 1886 Mar 30 07:47 SKO$ListKiller.class
-rw-rw-rw- 1 nobody nobody 4674 Mar 30 07:47 WEBepq.class

Linux compiler:

-rw-rw-rw- 1 wtg mdw 1156 Mar 22 14:08 OptionElement.class
-rw-rw-rw- 1 wtg mdw 40778 Mar 22 14:08 Order.class
-rw-rw-rw- 1 wtg mdw 25323 Mar 22 14:08 OrderRegel.class
-rw-rw-rw- 1 wtg mdw 8590 Mar 22 14:08 Prijzen.class
-rw-rw-rw- 1 wtg mdw 7452 Mar 22 14:08 PrinterSettings.class
-rw-rw-rw- 1 wtg mdw 2037 Mar 22 14:08 Rekening.class
drwxrwxrwx 5 wtg mdw 1024 Mar 22 14:08 relatiebeheer
-rw-rw-rw- 1 wtg mdw 3643 Mar 22 14:08 Relatie.class
-rw-rw-rw- 1 wtg mdw 5285 Mar 22 14:08 SelCri.class
-rw-rw-rw- 1 wtg mdw 5773 Mar 22 14:08 Selecties.class
drwxrwxrwx 2 wtg mdw 3072 Mar 22 14:08 servlets
-rw-rw-rw- 1 wtg mdw 1436 Mar 22 14:08 SKObegl.class
-rw-rw-rw- 1 wtg mdw 4346 Mar 23 15:29 SKO.class
-rw-rw-rw- 1 wtg mdw 1160 Mar 23 15:29 SKO$KillTimer.class
-rw-rw-rw- 1 wtg mdw 1798 Mar 23 15:29 SKO$ListKiller.class
-rw-rw-rw- 1 wtg mdw 4546 Mar 22 14:08 WEBepq.class

Differences I must say are marginal and are probably caused by the compiler internally writing "\n" here and there which is translated into something different on different platforms.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And hey - the winner is: linux!
But serious: It shouldn't depend on EOL, since your linux-code should work on win, and vice versa.
Some optimisations could be the source of this fact.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!