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 |
4ms | 845,309/s | |
ICONV |
5ms | 562,114/s | |
PHP |
2ms | 1,827,040/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
47ms | 64,444/s | |
ICONV |
38ms | 78,288/s | |
PHP |
27ms | 112,680/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
48ms | 63,007/s | |
ICONV |
40ms | 75,139/s | |
PHP |
169ms | 17,752/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
56ms | 53,576/s | |
ICONV |
33ms | 90,152/s | |
PHP |
148ms | 20,286/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
54ms | 55,662/s | |
ICONV |
56ms | 53,389/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
68ms | 44,037/s | |
ICONV |
63ms | 47,837/s | |
PHP |
36ms | 83,778/s | |