News for hackers. Stuff that matters.
Re:How the most popular Chrome extensions affect browser per... by esnard on Tuesday June 16, 2020 @09:03AM (#23538648)
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

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.

There are no comments on this comment yet.