On Sun, Mar 21, 2010 at 03:24, Ulf Zibis<ulf.zi...@gmx.de> wrote:
Am 21.03.2010 09:05, schrieb Martin Buchholz:
On Sat, Mar 20, 2010 at 15:50, Ulf Zibis<ulf.zi...@gmx.de> wrote:
I think, we should not define a distinct method for this once-used 3-liner:
for (; i< max-1; i++)
if (v[i] == high&& v[i+1] == low)
return i - offset;
HotSpots resources should not be over-stressed to inline such things, having
more reserves for more important things.
On the contrary -
normally the above code snippet will rarely be executed,
and so will normally not be inlined into the caller,
which makes it easier for hotspot to inline
the caller into its caller. Separate cold code into
separate methods.
Thanks, I got the idea.
But Isn't the push-call-pop-return overhead comparable with those 3
lines here, not to forget the repeated cache-3-values-once-more?
-Ulf
BTW, in case you try to benchmark this,
hotspot intrinsifies indexOf by default.
Martin