• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The Java Performance Companion Question: Could bytecode be improved

 
Greenhorn
Posts: 15
Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could Bytecode be improved?
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean bytecode in general, or for a specific application? Improved in which way?
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you expecting optimisation from the AOT compiler (=the javac tool, an Ahead Of Time compiler) as opposed to the JIT optimisation we have at present?
 
author
Posts: 7
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Byte codes could be improved but, as mentioned in the other replies, the byte codes are not executed directly for most performance critical applications. Instead the JIT compiler steps in and transforms the byte code to highly efficient native code. Thus, improving the byte code does not necessarily lead to improved application performance.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bengt Rutisson wrote:. . . Thus, improving the byte code does not necessarily lead to improved application performance.

Would it also make the bytecode impossible to execute on old JVMs? If so, goodbye backward compatibility.
 
Author
Posts: 285
12
Scala IntelliJ IDE Netbeans IDE Python Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Would it also make the bytecode impossible to execute on old JVMs? If so, goodbye backward compatibility.



We don't have this anyway--for precisely this reason. Classfiles are versioned, and if you compile something on Java 8 and try to run it on Java 6, for example, it'll fail. Like this, which comes from hello world compiled with JDK 8 and executed on 7:

Exception in thread "main" java.lang.UnsupportedClassVersionError: X : Unsupported major.minor version 52.0

But you can still (largely) _compile_ to an older bytecode. Mostly, sometimes, if you don't use the wrong new language features, or libraries...
 
Hinok Yohannes
Greenhorn
Posts: 15
Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hinok Yohannes wrote:Could Bytecode be improved?


Thank you so much for your replies I could only understand so much being a beginner and all.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Simon Roberts wrote:. . . Classfiles are versioned, and if you compile something on Java 8 and try to run it on Java 6, for example, it'll fail. . . .

Damn! I forgot all about that phenomenon.
 
reply
    Bookmark Topic Watch Topic
  • New Topic