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 |
3ms | 987,492/s | |
ICONV |
6ms | 538,406/s | |
PHP |
3ms | 1,190,004/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
43ms | 69,268/s | |
ICONV |
38ms | 79,338/s | |
PHP |
25ms | 118,577/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
49ms | 61,851/s | |
ICONV |
34ms | 87,548/s | |
PHP |
143ms | 21,039/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
56ms | 53,219/s | |
ICONV |
35ms | 85,656/s | |
PHP |
148ms | 20,210/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
56ms | 53,455/s | |
ICONV |
54ms | 55,880/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
67ms | 45,055/s | |
ICONV |
57ms | 53,011/s | |
PHP |
34ms | 87,336/s | |