codynoel / snappy

Automatically exported from code.google.com/p/snappy
Other
0 stars 0 forks source link

performance issue in snappy.cc - I am using version 1.1.2 #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
****What steps will reproduce the problem?
1. in version 1.1.2, when I tried to compress a file (created by dd: dd 
if=/dev/sda of=data bs=1GB count=1), I found one line in snappy.cc, 

code: assert(0 == memcmp(base, candidate, matched));  

takes a lot of time. in my observation: it takes more than 60% of the total 
compress time, mainly taken from memcmp(). 

****What is the expected output? What do you see instead?
N/A

****What version of the product are you using? On what operating system?
I am using redhat 6.0 

****Please provide any additional information below.
I created a single workaround as attached, I created a memcmp3() which is not 
fully compatible with memcmp(), but much better performance, since it doesn't 
need to return larger than, less than which save at least one instruction. 
meanwhile, I compare 8 bytes once. and proved 30-40% improvement. 

Original issue reported on code.google.com by jun.i.jin@gmail.com on 26 Dec 2014 at 4:20

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

It sounds like you've forgotten -DNDEBUG; don't compile Snappy with assertions 
if you want performance.

Original comment by se...@google.com on 26 Dec 2014 at 3:33

GoogleCodeExporter commented 9 years ago
ok。got it thanks

Original comment by jun.i.jin@gmail.com on 28 Dec 2014 at 7:20