]> git.ipfire.org Git - thirdparty/zlib-ng.git/commit
Add a struct func_table and function functableInit.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 24 Apr 2017 08:53:39 +0000 (10:53 +0200)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 24 Apr 2017 09:02:56 +0000 (11:02 +0200)
commitda5133848856cbef6a565736ba488b4b408922c8
tree8fa52c8633678c6659836863cb2d8770a9b76540
parentec02ecf104e1d3f1836a908a359f20aa93494df5
Add a struct func_table and function functableInit.
The struct contains pointers to select functions to be used by the
rest of zlib, and the init function selects what functions will be
used depending on what optimizations has been compiled in and what
instruction-sets are available at runtime.

Tests done on a haswell cpu running minigzip -6 compression of a
40M file shows a 2.5% decrease in branches, and a 25-30% reduction
in iTLB-loads. The reduction i iTLB-loads is likely mostly due to
the inability to inline functions. This also causes a slight
performance regression of around 1%, this might still be worth it
to make it much easier to implement new optimized functions for
various architectures and instruction sets.

The performance penalty will get smaller for functions that get more
alternative implementations to choose from, since there is no need
to add more branches to every call of the function.
Today insert_string has 1 branch to choose insert_string_sse
or insert_string_c, but if we also add for example insert_string_sse4
then that would have needed another branch, and it would probably
at some point hinder effective inlining too.
14 files changed:
CMakeLists.txt
Makefile.in
arch/aarch64/fill_window_arm.c
arch/arm/fill_window_arm.c
arch/x86/fill_window_sse.c
deflate.c
deflate.h
deflate_fast.c
deflate_medium.c
deflate_p.h
deflate_slow.c
functable.c [new file with mode: 0644]
functable.h [new file with mode: 0644]
win32/Makefile.msc