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 | 756,048/s | |
ICONV |
5ms | 560,224/s | |
PHP |
2ms | 1,846,154/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
47ms | 63,679/s | |
ICONV |
37ms | 81,562/s | |
PHP |
24ms | 122,659/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
51ms | 59,053/s | |
ICONV |
37ms | 81,009/s | |
PHP |
146ms | 20,598/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
55ms | 54,153/s | |
ICONV |
36ms | 83,987/s | |
PHP |
173ms | 17,357/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
55ms | 55,040/s | |
ICONV |
57ms | 52,933/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
69ms | 43,553/s | |
ICONV |
61ms | 48,995/s | |
PHP |
33ms | 90,945/s | |