On 10/11/2011 04:36 AM, Ulf Zibis wrote:
Am 30.09.2011 22:46, schrieb Xueming Shen:

I believe we changed from (b1 < xyz) to (b1 >> x) == -2 back to 2009(?) because the benchmark shows the "shift" version is slightly faster. Do you have any number shows any difference now. My non-scientific benchmark still suggests the "shift"
type is faster on -server vm, no significant difference on -client vm.

In this sense, then you should do the same here:
  87         private static boolean isNotContinuation(int b) {
  88             return (b >> 6) != -2;
  89         }

I don't know which one is better, I did a run on

    private static boolean op1(int b) {
        return (b >> 6) != -2;
    }
    private static boolean op2(int b) {
        return (b & 0xc0) != 0x80;
    }
    private static boolean op3(byte b) {
         return b >= (byte)0xc0;
    }

with 1000000 iteration on my linux machine,  and got the scores

op1=1149
op2=1147
op3=1146

I would interpret it as they are identical.



Additionally:
Make private:
  75     private static final void updatePositions(
  76             Buffer src, int sp, Buffer dst, int dp) {

updated accordingly

-Sherman

Reply via email to