]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
mark longest_match static inline
authorSebastian Pop <s.pop@samsung.com>
Tue, 15 Jan 2019 21:51:06 +0000 (15:51 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 16 Jan 2019 09:49:40 +0000 (10:49 +0100)
x86_64-linux compiled with clang and gcc at -O3 shows that inlining
longest_match() brings good speedup overall with speedups of up to 8%.
clang https://gist.github.com/sebpop/17d9c340cfaf16c1854017efefce6fc3
gcc https://gist.github.com/sebpop/451160356fc4e73541a1b8eef7dceb97

performance is also better on aarch64-linux with speedups up to 3.5%.
clang https://gist.github.com/sebpop/aec3e068a61c1daddf9c72ab4bc33281
gcc https://gist.github.com/sebpop/f0d4e6bfd58d95b313c955b5d747a74f

match_p.h

index 207aedf7be8ab5dc099d6d962b90b56d2e264053..f5f1ef7b92445b75690c7a81137078948621619c 100644 (file)
--- a/match_p.h
+++ b/match_p.h
@@ -45,7 +45,7 @@
  * Standard longest_match
  *
  */
-ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
+static inline unsigned longest_match(deflate_state *const s, IPos cur_match) {
     const unsigned wmask = s->w_mask;
     const Pos *prev = s->prev;
 
@@ -164,7 +164,7 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
  * UNALIGNED_OK longest_match
  *
  */
-ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
+static inline unsigned longest_match(deflate_state *const s, IPos cur_match) {
     const unsigned wmask = s->w_mask;
     const Pos *prev = s->prev;
 
@@ -346,7 +346,7 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
  *       -------------------------------------------------
  */
 
-ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
+static inline unsigned longest_match(deflate_state *const s, IPos cur_match) {
     unsigned int strstart = s->strstart;
     unsigned chain_length = s->max_chain_length;/* max hash chain length */
     unsigned char *window = s->window;