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 |
5ms | 633,045/s | |
ICONV |
10ms | 304,013/s | |
PHP |
3ms | 1,113,173/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
59ms | 50,695/s | |
ICONV |
40ms | 74,453/s | |
PHP |
24ms | 124,059/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
60ms | 50,320/s | |
ICONV |
47ms | 63,535/s | |
PHP |
196ms | 15,274/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
70ms | 43,007/s | |
ICONV |
46ms | 65,007/s | |
PHP |
219ms | 13,716/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
116ms | 25,911/s | |
ICONV |
74ms | 40,554/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
87ms | 34,330/s | |
ICONV |
65ms | 46,332/s | |
PHP |
66ms | 45,126/s | |