On 21 June 2012 16:59, Henrik Sperre Johansen <henrik.s.johansen@veloxit.no> wrote:
Btw, if you want to optimize for shorter-encodings, couldn't you do asm   cmp: asm EAX with: 16r80;   jl: oneByte;   cmp: asm EAX with: 16r800;   jl: twoBytes;   cmp: asm EAX with:16r1000;   jl: threeBytes;   label: fourBytes;   ...   jmp end;   label: threeBytes;   ...   jmp end;   label: twoBytes;   ...   jmp: end;   label: oneByte;
  label: end
ie only one cmp/jmp for 1-byte chars (1 less jump than current), and n cmp/2 jmp's for n > 1.
Haha, nice trick.
Or do the conditional jumps relying on last instruction stall enough that it doesn't really matter?
Can't say.. benchmarks should demonstrate that, but guess 1 less jump speedup will be at the level of noise. I'm not even sure that doing 4-byte aligned memory writes will get over noise level :)
Cheers, Henry
-- Best regards, Igor Stasenko.