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 | 827,586/s | |
ICONV |
6ms | 502,849/s | |
PHP |
3ms | 1,113,999/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
44ms | 67,519/s | |
ICONV |
39ms | 77,143/s | |
PHP |
25ms | 119,166/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
50ms | 60,235/s | |
ICONV |
35ms | 85,930/s | |
PHP |
143ms | 20,983/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
57ms | 52,517/s | |
ICONV |
35ms | 85,773/s | |
PHP |
150ms | 19,947/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
53ms | 56,191/s | |
ICONV |
53ms | 56,109/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
66ms | 45,582/s | |
ICONV |
62ms | 48,174/s | |
PHP |
34ms | 88,739/s | |