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 |
41ms | 73,217/s | |
| ICONV |
38ms | 78,676/s | |
| PHP |
30ms | 100,499/s | |
1K of clean ASCII
| Extension |
Time |
Rate |
|
| MBSTRING |
82ms | 36,788/s | |
| ICONV |
71ms | 42,192/s | |
| PHP |
52ms | 57,553/s | |
1K of clean UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
85ms | 35,430/s | |
| ICONV |
67ms | 44,991/s | |
| PHP |
176ms | 17,063/s | |
1K of dirty UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
91ms | 32,831/s | |
| ICONV |
67ms | 44,727/s | |
| PHP |
174ms | 17,243/s | |
1K of clean Shift_JIS
| Extension |
Time |
Rate |
|
| MBSTRING |
86ms | 35,027/s | |
| ICONV |
131ms | 22,949/s | |
| PHP |
n/a | n/a | |
1K of fallback Latin-1
| Extension |
Time |
Rate |
|
| MBSTRING |
119ms | 25,147/s | |
| ICONV |
113ms | 26,604/s | |
| PHP |
69ms | 43,708/s | |