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 |
94ms | 31,777/s | |
| ICONV |
102ms | 29,377/s | |
| PHP |
62ms | 48,425/s | |
1K of clean ASCII
| Extension |
Time |
Rate |
|
| MBSTRING |
158ms | 18,948/s | |
| ICONV |
85ms | 35,328/s | |
| PHP |
54ms | 56,042/s | |
1K of clean UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
102ms | 29,385/s | |
| ICONV |
151ms | 19,878/s | |
| PHP |
395ms | 7,598/s | |
1K of dirty UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
283ms | 10,619/s | |
| ICONV |
156ms | 19,243/s | |
| PHP |
211ms | 14,210/s | |
1K of clean Shift_JIS
| Extension |
Time |
Rate |
|
| MBSTRING |
107ms | 27,926/s | |
| ICONV |
128ms | 23,446/s | |
| PHP |
n/a | n/a | |
1K of fallback Latin-1
| Extension |
Time |
Rate |
|
| MBSTRING |
136ms | 22,025/s | |
| ICONV |
143ms | 20,993/s | |
| PHP |
121ms | 24,832/s | |