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

Compiler Optimisation

 
Greenhorn
Posts: 25
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's been really informative to read everyone's replies. Yes I finally found it's some compiler optimization for the "if(Boolean)... " construct, otherwise compiler would have warned me that local variable has not been initialised.

One last thing though would be great to know...

are there any more such compiler optimization's that java uses to loop around such discrepancies.
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

novice retard wrote:are there any more such compiler optimization's that java uses to loop around such discrepancies.


You can search if you want to know more about the code optimization(some example of it are as following) by the compiler:
1). Loop Optimization2). Dead code elimination
and many more...
 
Shiveen Pandita
Greenhorn
Posts: 25
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Gaurangkumar khalasi
@Campbell Ritchie
@Okti Wmcijewski

thanks.. you were great help. I'll be posting more questions.

I hope that all you guys will share your knowledge next time also like this.
 
Marshal
Posts: 74392
335
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shiveen Pandita wrote:It's been really informative to read everyone's replies.

You’re welcome

Yes I finally found it's some compiler optimization . . .

are there any more such compiler optimization's that java uses to loop around such discrepancies.

Most optimisation is actually carried out by the runtime, particularly if it finds the same code being executed repreately (I think ≥10000×).

Since the topic of this discussion has changed and looks very interesting, I am going to split part of this thread into a new thread and call it “Compiler Optimisation” or similar
 
Campbell Ritchie
Marshal
Posts: 74392
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This thread split from this old thread, where anybody wanting to see the earlier discussion can look.
 
Gaurangkumar Khalasi
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shiveen Pandita wrote:thanks.. you were great help. I'll be posting more questions.


You are welcome
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic