Switch vs if ?
bourges.laurent at gmail.com
Tue Jan 16 14:39:12 UTC 2018
Thank you for your feedback.
I should write a jmh test to cross-check but I have no time left.
It is for the marlin renderer ...
Le 16 janv. 2018 11:26 AM, "Kirk Pepperdine" <kirk at kodewerk.com> a écrit :
> I have an exercise in my workshop where the solution can use either a
> switch statement or if statements. IME there is absolutely no measurable
> difference between using either technique since JDK 1.6…. so.. my advice
> is, write readable code.
> Kind regards,
> Kirk Pepperdine
> > On Jan 16, 2018, at 10:41 AM, Laurent Bourgès <bourges.laurent at gmail.com>
> > Hi,
> > I ask you as you are the hotspot & jvm performance experts.
> > Do you know if hotspot prefers if over switch on integer values
> (profiling hotspots) ?
> > Is it worth to order integer cases with higher probability first or not ?
> > How to optimize such if cascades ?
> > Cheers,
> > Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-compiler-dev