Skip to content

Instantly share code, notes, and snippets.

@chansen
Created October 13, 2014 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chansen/957956e08069f239bbab to your computer and use it in GitHub Desktop.
Save chansen/957956e08069f239bbab to your computer and use it in GitHub Desktop.
Unicode::UTF8 vs Encode
$ perl benchmarks/bench.pl
perl: 5.020001 (darwin 13.3.0)
Encode: 2.60
Unicode::UTF8: 0.60
ar.txt: code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate Encode Unicode::UTF8
Encode 4121/s -- -83%
Unicode::UTF8 24613/s 497% --
el.txt: code points: 58748 (U+0000..U+007F: 13560 U+0080..U+07FF: 45150 U+0800..U+FFFF: 38)
Rate Encode Unicode::UTF8
Encode 1021/s -- -83%
Unicode::UTF8 5910/s 479% --
en.txt: code points: 82055 (U+0000..U+007F: 81988 U+0080..U+07FF: 18 U+0800..U+FFFF: 49)
Rate Encode Unicode::UTF8
Encode 1309/s -- -96%
Unicode::UTF8 29933/s 2187% --
ja.txt: code points: 64655 (U+0000..U+007F: 6913 U+0080..U+07FF: 30 U+0800..U+FFFF: 57712)
Rate Encode Unicode::UTF8
Encode 780/s -- -85%
Unicode::UTF8 5147/s 560% --
lv.txt: code points: 127160 (U+0000..U+007F: 117031 U+0080..U+07FF: 9021 U+0800..U+FFFF: 1108)
Rate Encode Unicode::UTF8
Encode 703/s -- -89%
Unicode::UTF8 6567/s 834% --
ru.txt: code points: 85266 (U+0000..U+007F: 19263 U+0080..U+07FF: 65639 U+0800..U+FFFF: 364)
Rate Encode Unicode::UTF8
Encode 678/s -- -84%
Unicode::UTF8 4132/s 509% --
sv.txt: code points: 92894 (U+0000..U+007F: 89510 U+0080..U+07FF: 3213 U+0800..U+FFFF: 171)
Rate Encode Unicode::UTF8
Encode 1118/s -- -92%
Unicode::UTF8 13561/s 1113% --
zh.txt: code points: 24519 (U+0000..U+007F: 5317 U+0080..U+07FF: 32 U+0800..U+FFFF: 19170)
Rate Encode Unicode::UTF8
Encode 2233/s -- -81%
Unicode::UTF8 11966/s 436% --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment