Advertisement

integer string快速转换优化流程

阅读量:

【前言】

在C/C++编程领域中存在大量string与integer转换的需求,在实际应用中往往会出现系统接口不够理想的情况或者性能表现不佳的问题。为了实现性能提升与个人研究目标两大核心目标,在优化策略方面进行了深入探索,并将分享这些优化工作中的关键点

【优化效果概览】

32位环境(-O2):********

[----------] 4 tests from performance

[ RUN ] performance.int32_to_str

fi2s int32 cost: 16765 us

snprintf int32 cost: 594351 us

!!!!!!!!!!!! fi2s(32) is 35.451894 times faster than snprintf

[ OK ] performance.int32_to_str (613 ms)

[ RUN ] performance.int64_to_str

fi2s int64 cost: 189455 us

snprintf int64 cost: 1625197 us

!!!!!!!!!!!! fi2s(64) is 8.578275 times faster than snprintf

[ OK ]

全部评论 (0)

还没有任何评论哟~