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 | 76,566/s | |
| ICONV |
39ms | 77,916/s | |
| PHP |
29ms | 104,504/s | |
1K of clean ASCII
| Extension |
Time |
Rate |
|
| MBSTRING |
88ms | 34,088/s | |
| ICONV |
71ms | 42,447/s | |
| PHP |
51ms | 59,012/s | |
1K of clean UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
83ms | 36,034/s | |
| ICONV |
69ms | 43,167/s | |
| PHP |
170ms | 17,627/s | |
1K of dirty UTF8
| Extension |
Time |
Rate |
|
| MBSTRING |
90ms | 33,445/s | |
| ICONV |
66ms | 45,179/s | |
| PHP |
189ms | 15,884/s | |
1K of clean Shift_JIS
| Extension |
Time |
Rate |
|
| MBSTRING |
85ms | 35,379/s | |
| ICONV |
86ms | 34,791/s | |
| PHP |
n/a | n/a | |
1K of fallback Latin-1
| Extension |
Time |
Rate |
|
| MBSTRING |
125ms | 24,085/s | |
| ICONV |
112ms | 26,881/s | |
| PHP |
68ms | 43,933/s | |