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 |
39ms | 77,908/s | |
| ICONV |
38ms | 78,767/s | |
| PHP |
31ms | 97,570/s | |
1K of clean ASCII
| Extension |
Time |
Rate |
|
| MBSTRING |
80ms | 37,708/s | |
| ICONV |
68ms | 43,955/s | |
| PHP |
50ms | 59,964/s | |
1K of clean UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
83ms | 35,994/s | |
| ICONV |
68ms | 44,095/s | |
| PHP |
171ms | 17,573/s | |
1K of dirty UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
92ms | 32,729/s | |
| ICONV |
68ms | 44,268/s | |
| PHP |
174ms | 17,250/s | |
1K of clean Shift_JIS
| Extension |
Time |
Rate |
|
| MBSTRING |
84ms | 35,761/s | |
| ICONV |
89ms | 33,739/s | |
| PHP |
n/a | n/a | |
1K of fallback Latin-1
| Extension |
Time |
Rate |
|
| MBSTRING |
115ms | 26,132/s | |
| ICONV |
107ms | 28,047/s | |
| PHP |
66ms | 45,564/s | |