lib_sanitize Benchmarks
- Each test is run 3000 times (you can modify a line at the top of this file to change that).
- iconv is generally fastest when not converting from another encoding.
- mbstring is generally fastest when converting from another encoding.
- PHP is significantly slower than both.
- PHP mode can't convert from anything other than Latin-1.
- The first number is time taken to perform the test set.
- The second number is how many loops can be performed per second.
- Refreshing will likely get you different results, with the same ratios.
Empty String
Extension |
Time |
Rate |
|
MBSTRING |
3ms | 862,565/s | |
ICONV |
5ms | 551,471/s | |
PHP |
2ms | 1,876,173/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
45ms | 67,185/s | |
ICONV |
39ms | 77,680/s | |
PHP |
21ms | 142,755/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
49ms | 60,761/s | |
ICONV |
35ms | 84,981/s | |
PHP |
141ms | 21,212/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
55ms | 54,465/s | |
ICONV |
35ms | 86,483/s | |
PHP |
145ms | 20,665/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
56ms | 53,191/s | |
ICONV |
57ms | 52,459/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
67ms | 44,782/s | |
ICONV |
60ms | 49,691/s | |
PHP |
32ms | 92,917/s | |