MPL—A Flexible Multiprecision Library
摘要
Multiprecision arithmetic is required in many applications, notably safety critical areas. It carries, however, a substantial performance impact compared to fixed precision arithmetic. Since a significant part of this is due to allocation and memory fragmentation, a substantial speed up can be obtained by optimising for small numbers by storing them inline on the stack rather than on the heap. Libraries implementing such an optimisation typically fix the range of numbers considered small. However, optimal performance requires customising this range depending on the problem. The contribution of this tool paper is to introduce MPL, a library for arbitrary fixed precision and multiprecision arithmetic, which allows developers to customise the range of small numbers based on the knowledge of their problem at compile time. We experimentally demonstrate that MPL can deliver significant speed-ups when benchmarked against GMP and CLN, both running microbenchmarks on our library. MPL is released under a permissive BSD license, and we also provide a full integration of MPL with cvc5, enabling using MPL as a back end in cvc5.