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 |
5ms | 560,015/s | |
ICONV |
18ms | 166,076/s | |
PHP |
15ms | 202,007/s | |
1K of clean ASCII
Extension |
Time |
Rate |
|
MBSTRING |
69ms | 43,489/s | |
ICONV |
57ms | 52,537/s | |
PHP |
38ms | 78,464/s | |
1K of clean UTF8
Extension |
Time |
Rate |
|
MBSTRING |
62ms | 48,620/s | |
ICONV |
48ms | 62,704/s | |
PHP |
206ms | 14,563/s | |
1K of dirty UTF8
Extension |
Time |
Rate |
|
MBSTRING |
69ms | 43,469/s | |
ICONV |
46ms | 64,597/s | |
PHP |
244ms | 12,305/s | |
1K of clean Shift_JIS
Extension |
Time |
Rate |
|
MBSTRING |
68ms | 44,417/s | |
ICONV |
67ms | 44,859/s | |
PHP |
n/a | n/a | |
1K of fallback Latin-1
Extension |
Time |
Rate |
|
MBSTRING |
98ms | 30,469/s | |
ICONV |
67ms | 44,506/s | |
PHP |
38ms | 78,511/s | |