Optimisation progress for libzahl, compared to other big integer libraries. These comparisons are for 152-bit integers. Functions in parenthesis the right column are functions that needs optimisation to improve the peformance of the function in the left column. Double-parenthesis means there may be a better way to do it. zset .................... fastest zseti ................... tomsfastmath is faster, otherwise fastest zsetu ................... tomsfastmath is faster, otherwise fastest zneg(a, b) .............. fastest zneg(a, a) .............. fastest zabs(a, b) .............. fastest zabs(a, a) .............. tomsfastmath is faster, otherwise fastest zadd_unsigned ........... fastest zsub_unsigned ........... fastest zadd .................... 98 % of libtommath, otherwise fastest zsub .................... 74 % of tomsfastmath, otherwise fastest zand .................... 69 % of tomsfastmath, otherwise fastest zor ..................... 39 % of tomsfastmath, otherwise fastest zxor .................... 52 % of tomsfastmath, otherwise fastest znot .................... fastest zeven ................... fastest zodd .................... fastest zeven_nonzero ........... fastest zodd_nonzero ............ fastest zzero ................... fastest zsignum ................. fastest zbits ................... gmp is faster, because of bug in libzahl zlsb .................... fastest zswap ................... fastest zlsh .................... fastest zrsh .................... fastest ztrunc(a, b, c) ......... fastest ztrunc(a, a, b) ......... fastest zsplit .................. fastest zcmpmag ................. gmp is faster, otherwise fastest zcmp .................... 80 % of hebimath, gmp is even faster (zcmpmag) zcmpi ................... fastest zcmpu ................... fastest zbset(a, b, 1) .......... fastest zbset(a, a, 1) .......... fastest zbset(a, b, 0) .......... fastest zbset(a, a, 0) .......... fastest zbset(a, b, -1) ......... fastest zbset(a, a, -1) ......... fastest zbtest .................. fastest zgcd .................... 26 % of gmp, otherwise fastest (zcmpmag) zmul .................... slowest zsqr .................... slowest (zmul) zmodmul(big mod) ........ slowest ((zmul, zmod)) zmodsqr(big mod) ........ slowest ((zmul, zmod)) zmodmul(tiny mod) ....... slowest ((zmul)) zmodsqr(tiny mod) ....... slowest ((zmul)) zpow .................... slowest (zmul, zsqr) zpowu ................... slowest (zmul, zsqr) zmodpow ................. slowest (zmul, zsqr. zmod) zmodpowu ................ slowest (zmul, zsqr, zmod) zsets ................... 14 % of gmp, otherwise fastest zstr_length(a, 10) ...... gmp is faster, otherwise fastest (zdiv, zsqr) zstr(a, b, n) ........... 10 % of gmp, otherwise fastest zrand(default uniform) .. gmp and tomsfastmath are faster zptest .................. slowest (zrand, zmodpow, zsqr, zmod) zsave ................... fastest zload ................... fastest zdiv(big denum) ......... slowest (zdivmod) zmod(big denum) ......... slowest (zdivmod) zdivmod(big denum) ...... slowest (excluding hebimath) zdiv(tiny denum) ........ fastest zmod(tiny denum) ........ fastest zdivmod(tiny denum) ..... fastest Note, some corresponding functions are not implemented in some other libraries. In such cases, they have been implemented in the translation layers (found under bench/). Those implementations are often suboptimal, but probably in style with what you would write if you need that functionality. Note further, that if, for example, you want do perform addition and you know that your operands are non-negative, you would choose zadd_unsigned in libzahl, but if you are using a library that does not have the corrsponding function, you are better of with the regular addition (zadd). Also note, TomsFastMath does not support arbitrarily large integers, which gives is a significant performance advantage. Furthermore, not failure check is done with GMP. Additionally, hebimath is some functions that are not working correctly; those have been excluded from the comparison. Also note, NOT does not mean the same thing in all libraries, for example in GMP it means (-x - 1), thus, znot does not use GMP's NOT in the translations layer.