summaryrefslogtreecommitdiff
path: root/snappy.cc
diff options
context:
space:
mode:
authorsnappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143>2013-06-14 21:42:26 +0000
committersnappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143>2013-06-14 21:42:26 +0000
commit062bf544a61107db730b6d08cb0b159c4dd9b24c (patch)
tree7ddf072a44e0d70c691b98a3457022ae8c45e119 /snappy.cc
parent328aafa1980824a9afdcd50edc30d9d5157e417f (diff)
downloadsnappy-062bf544a61107db730b6d08cb0b159c4dd9b24c.tar.gz
snappy-062bf544a61107db730b6d08cb0b159c4dd9b24c.tar.bz2
snappy-062bf544a61107db730b6d08cb0b159c4dd9b24c.zip
Make the two IncrementalCopy* functions take in an ssize_t instead of a len,
in order to avoid having to do 32-to-64-bit signed conversions on a hot path during decompression. (Also fixes some MSVC warnings, mentioned in public issue 75, but more of those remain.) They cannot be size_t because we expect them to go negative and test for that. This saves a few movzwl instructions, yielding ~2% speedup in decompression. Sandy Bridge: Benchmark Base (ns) New (ns) Improvement ------------------------------------------------------------------------------------------------- BM_UFlat/0 48009 41283 2.3GB/s html +16.3% BM_UFlat/1 531274 513419 1.3GB/s urls +3.5% BM_UFlat/2 7378 7062 16.8GB/s jpg +4.5% BM_UFlat/3 92 92 2.0GB/s jpg_200 +0.0% BM_UFlat/4 15057 14974 5.9GB/s pdf +0.6% BM_UFlat/5 204323 193140 2.0GB/s html4 +5.8% BM_UFlat/6 13282 12611 1.8GB/s cp +5.3% BM_UFlat/7 6511 6504 1.6GB/s c +0.1% BM_UFlat/8 2014 2030 1.7GB/s lsp -0.8% BM_UFlat/9 775909 768336 1.3GB/s xls +1.0% BM_UFlat/10 182 184 1043.2MB/s xls_200 -1.1% BM_UFlat/11 167352 161630 901.2MB/s txt1 +3.5% BM_UFlat/12 147393 142246 842.8MB/s txt2 +3.6% BM_UFlat/13 449960 432853 944.4MB/s txt3 +4.0% BM_UFlat/14 620497 594845 775.9MB/s txt4 +4.3% BM_UFlat/15 265610 267356 1.8GB/s bin -0.7% BM_UFlat/16 206 205 932.7MB/s bin_200 +0.5% BM_UFlat/17 25561 24730 1.4GB/s sum +3.4% BM_UFlat/18 2620 2644 1.5GB/s man -0.9% BM_UFlat/19 45766 38589 2.9GB/s pb +18.6% BM_UFlat/20 171107 169832 1039.5MB/s gaviota +0.8% Sum of all benchmarks 3500103 3394565 +3.1% Westmere: Benchmark Base (ns) New (ns) Improvement ------------------------------------------------------------------------------------------------- BM_UFlat/0 72624 71526 1.3GB/s html +1.5% BM_UFlat/1 735821 722917 930.8MB/s urls +1.8% BM_UFlat/2 10450 10172 11.7GB/s jpg +2.7% BM_UFlat/3 117 117 1.6GB/s jpg_200 +0.0% BM_UFlat/4 29817 29648 3.0GB/s pdf +0.6% BM_UFlat/5 297126 293073 1.3GB/s html4 +1.4% BM_UFlat/6 28252 27994 842.0MB/s cp +0.9% BM_UFlat/7 12672 12391 862.1MB/s c +2.3% BM_UFlat/8 3507 3425 1040.9MB/s lsp +2.4% BM_UFlat/9 1004268 969395 1018.0MB/s xls +3.6% BM_UFlat/10 233 227 844.8MB/s xls_200 +2.6% BM_UFlat/11 230054 224981 647.8MB/s txt1 +2.3% BM_UFlat/12 201229 196447 610.5MB/s txt2 +2.4% BM_UFlat/13 609547 596761 685.3MB/s txt3 +2.1% BM_UFlat/14 824362 804821 573.8MB/s txt4 +2.4% BM_UFlat/15 371095 374899 1.3GB/s bin -1.0% BM_UFlat/16 267 267 717.8MB/s bin_200 +0.0% BM_UFlat/17 44623 43828 835.9MB/s sum +1.8% BM_UFlat/18 5077 4815 841.0MB/s man +5.4% BM_UFlat/19 74964 73210 1.5GB/s pb +2.4% BM_UFlat/20 237987 236745 746.0MB/s gaviota +0.5% Sum of all benchmarks 4794092 4697659 +2.1% Istanbul: Benchmark Base (ns) New (ns) Improvement ------------------------------------------------------------------------------------------------- BM_UFlat/0 98614 96376 1020.4MB/s html +2.3% BM_UFlat/1 963740 953241 707.2MB/s urls +1.1% BM_UFlat/2 25042 24769 4.8GB/s jpg +1.1% BM_UFlat/3 180 180 1065.6MB/s jpg_200 +0.0% BM_UFlat/4 45942 45403 1.9GB/s pdf +1.2% BM_UFlat/5 400135 390226 1008.2MB/s html4 +2.5% BM_UFlat/6 37768 37392 631.9MB/s cp +1.0% BM_UFlat/7 18585 18200 588.2MB/s c +2.1% BM_UFlat/8 5751 5690 627.7MB/s lsp +1.1% BM_UFlat/9 1543154 1542209 641.4MB/s xls +0.1% BM_UFlat/10 381 388 494.6MB/s xls_200 -1.8% BM_UFlat/11 339715 331973 440.1MB/s txt1 +2.3% BM_UFlat/12 294807 289418 415.4MB/s txt2 +1.9% BM_UFlat/13 906160 884094 463.3MB/s txt3 +2.5% BM_UFlat/14 1224221 1198435 386.1MB/s txt4 +2.2% BM_UFlat/15 516277 502923 979.5MB/s bin +2.7% BM_UFlat/16 405 402 477.2MB/s bin_200 +0.7% BM_UFlat/17 61640 60621 605.6MB/s sum +1.7% BM_UFlat/18 7326 7383 549.5MB/s man -0.8% BM_UFlat/19 94720 92653 1.2GB/s pb +2.2% BM_UFlat/20 360435 346687 510.6MB/s gaviota +4.0% Sum of all benchmarks 6944998 6828663 +1.7% git-svn-id: https://snappy.googlecode.com/svn/trunk@77 03e5f5b5-db94-4691-08a0-1a8bf15f6143
Diffstat (limited to 'snappy.cc')
-rw-r--r--snappy.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/snappy.cc b/snappy.cc
index 0b4c6da..2468a1c 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -94,7 +94,7 @@ enum {
// ababababababababababab
// Note that this does not match the semantics of either memcpy()
// or memmove().
-static inline void IncrementalCopy(const char* src, char* op, int len) {
+static inline void IncrementalCopy(const char* src, char* op, ssize_t len) {
assert(len > 0);
do {
*op++ = *src++;
@@ -136,9 +136,7 @@ namespace {
const int kMaxIncrementCopyOverflow = 10;
-} // namespace
-
-static inline void IncrementalCopyFastPath(const char* src, char* op, int len) {
+inline void IncrementalCopyFastPath(const char* src, char* op, ssize_t len) {
while (op - src < 8) {
UnalignedCopy64(src, op);
len -= op - src;
@@ -152,6 +150,8 @@ static inline void IncrementalCopyFastPath(const char* src, char* op, int len) {
}
}
+} // namespace
+
static inline char* EmitLiteral(char* op,
const char* literal,
int len,