High Performance Flexible Memory Allocators in Complex Projects (Iliya Trub, ISPRASOPEN-2019)
Материал из 0x1.tv
- Илья Труб
English Translation for http://0x1.tv/20191206AC
Proposes the methodology of data analysis and code design solutions that improve flexibility of custom allocator assignment for simple data types and instances of data type classes. The methodology is based on special wrappers of memory functions, collecting data by execution of source code, and analyzing allocation/release traces with subsequent patterns extraction. Then the corresponding custom allocator is chosen for each found pattern and implemented in some module of source code as a container for user data, replacing malloc/free. The article describes the usage of the proposed approach for LLVM (Low Level Virtual Machine), that is well known tool for building compilers. It is shown that the choice of appropriate allocator provides the improvement of LLVM-based compiler's performance.
The appropriate custom allocator is more effective than malloc, in particular, linear allocator for StringMap and DomTreeNodeBase, stack allocator for BitVector and linked list allocator for Buckets. Aggregate performance improvement reaches around 10%. Practical results of work are implemented in shaders' compiler, but this methodology can be used in any project, which uses LLVM or, generally, performs memory requests more or less intensively.