xiaolu / lz4

Automatically exported from code.google.com/p/lz4
1 stars 1 forks source link

Enhancement: Unneccessary code in 32 bit mode #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In LZ4_uncompress:

This code: A32(op)=A32(ref);
does not appear to have any effect when running in 32-bit mode. It should be 
put inside of #if LZ4_ARCH64

Original issue reported on code.google.com by strig...@gmail.com on 5 Dec 2012 at 8:24

GoogleCodeExporter commented 9 years ago
If i do remember correctly,
i tested that already.

I've been surprised to note that, by removing the "A32(op)=A32(ref);" which is 
indeed useless in 32 bits mode, the decoder became (slightly) slower, or at 
best was unaffected by the change (depending on compiler and version).
So i let it this way, intentionnally.

Back then, i was suspecting this strange result was a side-effect of compiler 
optimisations.

I can nonetheless re-test this.

Original comment by yann.col...@gmail.com on 6 Dec 2012 at 1:01

GoogleCodeExporter commented 9 years ago
I checked the removing on instruction A32(op)=A32(ref);

From an assembler perspective, it removes 2 instructions :
  00113 8b 10        mov     edx, DWORD PTR [eax]
  00115 89 11        mov     DWORD PTR [ecx], edx

In spite of this, the version without these instructions is actually slower 
(although the difference is within 0.5%, but it tends to be repeatable).

It might be due to some pre-fetching side-effects.

Original comment by yann.col...@gmail.com on 8 Dec 2012 at 12:16

GoogleCodeExporter commented 9 years ago
Doesn't bring benefits to speed

Original comment by yann.col...@gmail.com on 11 Dec 2012 at 1:42