From: Sebastian Pop Date: Tue, 15 Jan 2019 21:51:06 +0000 (-0600) Subject: mark longest_match static inline X-Git-Tag: 1.9.9-b1~556 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c4fe01470e4777813e905695c2307ce2fb70430;p=thirdparty%2Fzlib-ng.git mark longest_match static inline 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 --- diff --git a/match_p.h b/match_p.h index 207aedf7..f5f1ef7b 100644 --- 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;