Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
JIT fixnum cases (with a value span <= 32) as a tableswitch #4430
... instead of falling back to lookupswitch
noticed (while fixing #4429) that only "perfect" consecutive fixnum cases generate a tableswitch
javac does some table/lookup space cost calc to decide, here just a simple size bound (of 32) is implemented
yep, sorry about the style changes (although in this case I might have done it on purpose - the
since an update some time back my IDEA has never been the same - was glad to get the jruby project working again I need to spent some time setting it up as I need to manually undo changes it does for me.
will do a micro bench test whether its worth the change (should be since its expected to jump directly skiping the lookup part) -> will post back with numbers.
thanks @olleolleolle ... sorry not into style updates really at this point (this code might get rejected).
have done some micro benchmarks previously (as @enebo suggested) and the change seemed only make a little difference, so I am not sure if tableswitch makes sense over lookupswitch if it 'complicates' code. but than maybe I have done it wrong - someone better understanding the difference in terms of JVM (and native code jitting) should decide whether this makes sense or not really ...