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 | 744,602/s | |
| ICONV |
5ms | 623,830/s | |
| PHP |
2ms | 1,779,359/s | |
1K of clean ASCII
| Extension |
Time |
Rate |
|
| MBSTRING |
43ms | 70,532/s | |
| ICONV |
50ms | 59,736/s | |
| PHP |
33ms | 91,639/s | |
1K of clean UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
58ms | 51,754/s | |
| ICONV |
34ms | 86,964/s | |
| PHP |
142ms | 21,198/s | |
1K of dirty UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
55ms | 54,115/s | |
| ICONV |
34ms | 88,773/s | |
| PHP |
146ms | 20,550/s | |
1K of clean Shift_JIS
| Extension |
Time |
Rate |
|
| MBSTRING |
57ms | 52,284/s | |
| ICONV |
55ms | 54,429/s | |
| PHP |
n/a | n/a | |
1K of fallback Latin-1
| Extension |
Time |
Rate |
|
| MBSTRING |
64ms | 47,065/s | |
| ICONV |
59ms | 51,020/s | |
| PHP |
35ms | 84,722/s | |