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 | 599,281/s | |
ICONV |
7ms | 456,135/s | |
PHP |
3ms | 1,092,498/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
56ms | 53,517/s | |
ICONV |
42ms | 72,280/s | |
PHP |
25ms | 119,171/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
61ms | 49,082/s | |
ICONV |
48ms | 62,410/s | |
PHP |
198ms | 15,162/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
69ms | 43,175/s | |
ICONV |
47ms | 64,059/s | |
PHP |
201ms | 14,892/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
69ms | 43,574/s | |
ICONV |
66ms | 45,571/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
85ms | 35,402/s | |
ICONV |
66ms | 45,306/s | |
PHP |
39ms | 77,886/s | |