Differences From Artifact [5b9953e18a]:
- File
src/OFInflateStream.m
— part of check-in
[6a0bf8be32]
at
2019-03-20 21:04:36
on branch trunk
— Force inline tryReadBits and of_huffman_tree_walk
This gives a significant performance improvement, cutting decompression
time almost in half. (user: js, size: 16815) [annotate] [blame] [check-ins using]
To Artifact [2d02df5db2]:
- File src/OFInflateStream.m — part of check-in [e0a330b377] at 2019-09-29 20:53:32 on branch trunk — Reduce ivar scopes (user: js, size: 16786) [annotate] [blame] [check-ins using] [more...]
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ | < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <assert.h> |
| ︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
};
#endif
static const uint8_t codeLengthsOrder[19] = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
static struct of_huffman_tree *fixedLitLenTree, *fixedDistTree;
static OF_INLINE bool
tryReadBits(OFInflateStream *stream, uint16_t *bits, uint8_t count)
{
uint16_t ret = stream->_savedBits;
assert(stream->_savedBitsLength < count);
| > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
};
#endif
static const uint8_t codeLengthsOrder[19] = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
static struct of_huffman_tree *fixedLitLenTree, *fixedDistTree;
@implementation OFInflateStream
static OF_INLINE bool
tryReadBits(OFInflateStream *stream, uint16_t *bits, uint8_t count)
{
uint16_t ret = stream->_savedBits;
assert(stream->_savedBitsLength < count);
|
| ︙ | ︙ | |||
144 145 146 147 148 149 150 | stream->_savedBits = 0; stream->_savedBitsLength = 0; *bits = ret; return true; } | < | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
stream->_savedBits = 0;
stream->_savedBitsLength = 0;
*bits = ret;
return true;
}
+ (void)initialize
{
uint8_t lengths[288];
if (self != [OFInflateStream class])
return;
|
| ︙ | ︙ |