Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

The Java Module System question

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nicolai,

Congratulations on writing the book, am sure many peoples will benefit from it.
My question is does the book include a comparison of the performance of an application that is written with modules against an application that doesn't use modules?

Cheers.
 
Ranch Hand
Posts: 109
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although this question is something that would be better answered by Nicolai Parlog, I don't see how useful would be comparing the performance of modularized vs non-modularized since the merely modularization of an application is not meaningful to performance. Although yes, I agree, monolith applications do not have that extra level of indirection.

What modularization brings to applications are (https://www.developer.com/java/other/modularity-in-java-java-9-modularity-versus-prior-versions.html):
- Because it comprises individual modules, it leverages reusability. Some (or all) components may be reused in any other program.
- A modular code is more readable than a monolithic code.
- It is easy to maintain and upgrade because individual components have separate concerns.
- Modular programs are comparatively easy to debug because their decoupled nature isolates individual components for a quick unit test.

What could impact performance, on the other hand, are the new improvements to the compiler of Java 9+ (experimental AOT) compared to Java 8-.
https://www.infoworld.com/article/3227244/java-9-is-here-everything-you-need-to-know.html
 
Greenhorn
Posts: 17
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My question is does the book include a comparison of the performance of an application that is written with modules against an application that doesn't use modules?



No, it doesn't. As Jorge correctly points out, the module system isn't about performance and it has very little impact on it. It's not zero, though. First of all, the module system applies a number of checks at launch time and that takes a little time of course. On the plus side, it indexes JARs on the module path by the packages they contain, making class-loading a little faster because the loader knows which JAR to check for which package. Both of them have negligible impact on launch performance and no impact on peak performance. If you care about the former, take a look at application class-data sharing and at Graal's ahead-of-time compiler.
 
Ranch Hand
Posts: 110
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

We faced similar questions as to understand and migrate to Java 9 Module system to take advantages of performance improvement but we never went in that path because
that was not the whole purpose of the Java 9 modules system,my understanding of what Nicolai mentioned on this post


" it indexes JARs on the module path by the packages they contain, making class-loading a little faster because the loader knows which JAR to check for which package"

.

is a very similar reference  that I found here on the Oracle-Java site

"Improved performance—The JVM uses various optimization techniques to improve application performance. JSR 376 indicates that these techniques are more effective when it’s known in advance that required types are located only in specific modules.
"
understanding-java-9-module

Please correct me if i am wrong in comparing both these statements
 
Nicolai Parlog
Greenhorn
Posts: 17
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Please correct me if i am wrong in comparing both these statements



You're correct, Oracle's statement and mine describe the same mechanism and performance improvement.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic