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 |
9ms | 334,076/s | |
ICONV |
6ms | 507,958/s | |
PHP |
3ms | 973,078/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
55ms | 54,281/s | |
ICONV |
41ms | 73,886/s | |
PHP |
24ms | 123,650/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
61ms | 49,362/s | |
ICONV |
48ms | 63,029/s | |
PHP |
196ms | 15,292/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
68ms | 43,889/s | |
ICONV |
47ms | 64,338/s | |
PHP |
196ms | 15,306/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
67ms | 44,975/s | |
ICONV |
66ms | 45,460/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
84ms | 35,892/s | |
ICONV |
64ms | 46,866/s | |
PHP |
38ms | 79,715/s | |