mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
Drop the "?" from "copy_history32?".
This makes the caller, not the implementation, responsible for detecting short reads and writes. This (the lack of "?") is consistent with the slice.copy_from method. name old speed new speed delta puffs_flate_decode_1k/clang 117MB/s ± 6% 120MB/s ± 0% +2.31% (p=0.016 n=5+5) puffs_flate_decode_10k/clang 153MB/s ± 1% 155MB/s ± 0% +1.16% (p=0.008 n=5+5) puffs_flate_decode_100k/clang 168MB/s ± 1% 177MB/s ± 0% +5.41% (p=0.008 n=5+5) puffs_flate_decode_1k/gcc 127MB/s ± 1% 143MB/s ± 0% +12.15% (p=0.008 n=5+5) puffs_flate_decode_10k/gcc 145MB/s ± 0% 180MB/s ± 1% +24.00% (p=0.008 n=5+5) puffs_flate_decode_100k/gcc 163MB/s ± 0% 212MB/s ± 1% +29.90% (p=0.008 n=5+5)
This commit is contained in:
1 parent
a1271222a4
commit
2e883fcc23
11 files changed
+155
-116
No files matched your search
@@ -385,6 +385,41 @@ static inline uint64_t puffs_base_slice_u8_copy_from(puffs_base_slice_u8 dst,
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline uint32_t puffs_base_writer1_copy_history32(uint8_t** ptr_ptr,
|
||||
uint8_t* start,
|
||||
uint8_t* end,
|
||||
uint32_t distance,
|
||||
uint32_t length) {
|
||||
uint8_t* ptr = *ptr_ptr;
|
||||
size_t d = ptr - start;
|
||||
if ((d == 0) || (d < (size_t)(distance))) {
|
||||
return 0;
|
||||
}
|
||||
start = ptr - distance;
|
||||
size_t l = end - ptr;
|
||||
if ((size_t)(length) > l) {
|
||||
length = l;
|
||||
} else {
|
||||
l = length;
|
||||
}
|
||||
// TODO: is manual unrolling actually helpful?
|
||||
for (; l >= 8; l -= 8) {
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
*ptr++ = *start++;
|
||||
}
|
||||
for (; l; l--) {
|
||||
*ptr++ = *start++;
|
||||
}
|
||||
*ptr_ptr = ptr;
|
||||
return length;
|
||||
}
|
||||
|
||||
#endif // PUFFS_BASE_IMPL_H
|
||||
|
||||
// ---------------- Status Codes Implementations
|
||||
|
||||
Reference in new issue
Block a user