3 ms·
When you have an array, it's way faster to check the existence of array[key], which is O(1), than to loop over the full array to find if one of the values match
by esnard 6y ago
When you have an array, it's way faster to check the existence of array[key], which is O(1), than to loop over the full array to find if one of the values match the one you're searching for, which is O(n).
This is used in hash tables, for example: https://en.wikipedia.org/wiki/Hash_table https://en.wikipedia.org/wiki/Hash_table
Object properties in JS are mostly the same thing.
I guess other extensions can't do the same because they don't have a simple value to search in a whitelist, but rather a list of regex which must all be executed.