Switch vs if ?
Laurent Bourgès
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 ...
Cheers,
Laurent
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>
> wrote:
> >
> > 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...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20180116/93d2b9a2/attachment.html>
More information about the hotspot-compiler-dev
mailing list