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 | 778,412/s | |
ICONV |
5ms | 630,120/s | |
PHP |
2ms | 1,871,491/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
45ms | 67,257/s | |
ICONV |
36ms | 82,329/s | |
PHP |
24ms | 123,244/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
48ms | 62,934/s | |
ICONV |
35ms | 84,928/s | |
PHP |
145ms | 20,707/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
55ms | 54,375/s | |
ICONV |
33ms | 90,004/s | |
PHP |
155ms | 19,312/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
54ms | 55,213/s | |
ICONV |
55ms | 54,057/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
65ms | 46,219/s | |
ICONV |
58ms | 52,118/s | |
PHP |
33ms | 90,895/s | |