高性能的C语言字符串转换的集合

jopen 12年前

高性能的C语言字符串转换的集合,通常比标准的实现快2倍。

包括:

  • base64, standard
  • base64, web/url safe, with configurable alphabet
  • base85 (good for http cookies)
  • base16 (hex)
  • base2 (ascii binary)
  • url escaping
  • javascript string escaping
  • fast number to string conversion, 4-22x faster than sprintf!
  • fast ascii upper/lower case conversion, 2-66x faster than stdlib! (yes, 66x faster)

And it's all wrapped up in a bow for you to use:

  • BSD License -- do what you want with it.
  • Standard clean ANSI C, will also compile as C99 and C++
  • C++ wrappers for std::string
  • Standard install: configure && make && make install
  • Extensive unit tests provided with >98% coverage.
  • Endian safe.
  • Performance test framework -- don't take my word, run it your self
  • Lots of in-code documentation

HEY

  • 此代码可以在Windows上编译。我试图解决缺乏stdint和stdbool,但我无法测试出来。
  • Also this code won't work on Sparc chips (Solaris) due to alignment issues. not hard to fix, but I don't have access to sparc machines
  • Works great on Mac and Linux.
  • No idea about iOS and ARM chips.

项目主页:http://www.open-open.com/lib/view/home/1352296364938