XmacsLabs / lolly

lolly: A user-friendly C++ library
https://xmacslabs.github.io/lolly/
GNU General Public License v3.0
10 stars 6 forks source link

[8_11] optimize performance of as_hexadecimal #334

Closed jingkaimori closed 4 months ago

jingkaimori commented 4 months ago

Performance

Before

complexityN ns/op op/s err% total benchmark
1 16.13 61,983,083.42 1.1% 0.08 convert unsigned int to hexadecimal string
2 17.66 56,613,212.10 1.6% 0.09 convert unsigned int to hexadecimal string
3 18.61 53,742,458.03 0.4% 0.09 convert unsigned int to hexadecimal string
4 20.91 47,819,863.10 0.6% 0.10 convert unsigned int to hexadecimal string
5 24.17 41,368,070.45 0.4% 0.12 convert unsigned int to hexadecimal string

After

complexityN ns/op op/s err% total benchmark
1 15.82 63,221,389.11 0.4% 0.08 convert unsigned int to hexadecimal string
2 15.76 63,449,120.53 1.6% 0.08 convert unsigned int to hexadecimal string
3 17.98 55,615,898.20 1.0% 0.09 convert unsigned int to hexadecimal string
4 17.53 57,043,784.30 2.8% 0.08 convert unsigned int to hexadecimal string
5 16.19 61,784,470.21 0.4% 0.08 convert unsigned int to hexadecimal string