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 | 742,574/s | |
| ICONV |
5ms | 622,924/s | |
| PHP |
2ms | 1,797,484/s | |
1K of clean ASCII
| Extension |
Time |
Rate |
|
| MBSTRING |
43ms | 69,019/s | |
| ICONV |
38ms | 79,210/s | |
| PHP |
25ms | 120,919/s | |
1K of clean UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
51ms | 58,478/s | |
| ICONV |
34ms | 89,060/s | |
| PHP |
141ms | 21,218/s | |
1K of dirty UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
55ms | 54,321/s | |
| ICONV |
33ms | 91,258/s | |
| PHP |
149ms | 20,197/s | |
1K of clean Shift_JIS
| Extension |
Time |
Rate |
|
| MBSTRING |
63ms | 47,307/s | |
| ICONV |
53ms | 56,229/s | |
| PHP |
n/a | n/a | |
1K of fallback Latin-1
| Extension |
Time |
Rate |
|
| MBSTRING |
64ms | 46,757/s | |
| ICONV |
62ms | 48,731/s | |
| PHP |
33ms | 89,793/s | |