The results of the assessment of the impact on performance from rebuilding packages for Ubuntu with various options and memory allocation function implementations have been published. The experimenter was able to increase the performance of the jq package, which is a tool for processing data in JSON format, by 90% (1.9 times) through regular rebuilding from the same package with source code, without making any changes to the code itself. Performance was evaluated by measuring the execution time of a typical filtering query on GeoJSON data, sized at 500MB.
Experiment results:
- The version compiled in GCC from the same source codes with default flags was found to be 2-4% faster than the binary package of Ubuntu.
- Rebuilding in Clang 18 with optimization level '-O3', enabling link-time optimization ('-flto'), and disabling debug information ('-DNDEBUG') led to a 20% speedup.
- Rebuilding with the TCMalloc memory allocation system (adding '-L/usr/lib/x86_64-linux-gnu -ltcmalloc_minimal' in LDFLAGS) resulted in a 40% speedup.
- Replacing malloc functions with memory allocation systems tcmalloc, jemalloc, and mimalloc via 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/lib….so' led to performance increases of 27%, 29%, and 44%. When run with mimalloc, which showed a 44% speedup, the environment variable 'MIMALLOC_LARGE_OS_PAGES=1' was set.
- Rebuilding the package with mimalloc in LDFLAGS instead of linking via LD_PRELOAD resulted in a 90% speedup in the test passage. Another test processing 2.2GB of JSON data in 13,000 files also showed a performance increase of about double.
Source: opennet.ru
