Enabled cmake Release build type (-O3) and LTO for C/C++ code #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Few weeks ago compared brotli4j with 5 years old jbrotli with my private benchmarks, and was surprised that brotli4j with compression level 10 in many cases is 2-3x slower than old jbrotli
Issue is that only JNI C++ code is compiled with -O3 optimizations, and all Brotli C code is compiled with default level, which is -O0 + Debug info
Log is obtained with
SET (CMAKE_VERBOSE_MAKEFILE ON)
As result, on linux, libbrotli.so is pretty large 3.7MB and resulting native jar is 1.8MB
This PR
Test system:
OS: Ubuntu 18.04.5 LTS
CPU 4 core: Intel(R) Core(TM) i5-7440HQ CPU @ 2.80GHz
GLIBC 2.27-3ubuntu1.4
C/C++ compiler GNU 11.1.0
cmake 3.21.0
Java: /usr/lib/jvm/java-8-oracle/bin/java (found version "1.8.0.201")
My benchmarks take about 12 hours, here sample output, ns/byte is column to consider for speed (ignore ms), brotli4=brotli4j