Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Efficiency] Use ES6 Map()/Set() in lieu of Object where possible #1070

Closed
gorhill opened this issue Dec 14, 2015 · 4 comments
Closed

[Efficiency] Use ES6 Map()/Set() in lieu of Object where possible #1070

gorhill opened this issue Dec 14, 2015 · 4 comments

Comments

@gorhill
Copy link
Owner

gorhill commented Dec 14, 2015

Benchmarks:

For instances in the code where no iteration through the set is needed, we can use a shim for versions of Chromium older than 38 -- Firefox supports ES6 Set() since FF 13.

Because for...of is supported only for Chromium 38+, for instances in the code where iterations through the set is needed, this will have to wait for longer term. Possibly a v2.0 of uBO will be incompatible with Chromium version 37 and older.

@gorhill
Copy link
Owner Author

gorhill commented Dec 15, 2015

Need to survey where else conversion to Set/Map is possible.

@gorhill gorhill reopened this Dec 15, 2015
@gorhill gorhill changed the title [Efficiency] Use ES6 Set() in lieu of Object where possible [Efficiency] Use ES6 Map()/Set() in lieu of Object where possible Sep 5, 2016
@gorhill
Copy link
Owner Author

gorhill commented Sep 5, 2016

https://jsperf.com/ is down, so there is a custom benchmark now: https://gorhill.github.io/obj-vs-set-vs-map/.

gorhill added a commit that referenced this issue Sep 12, 2016
At the same time, the following issues were fixed:
- #1954: automatically lookup site-specific scriptlets
- uBlockOrigin/uAssets#23
@kurtextrem
Copy link

@gorhill Thank you very much for doing that. First of all it is great to have an efficient blocker and at the same time an open development. The benchmark for Set/Map was interesting, I'm gonna use it as well.

@lewisje
Copy link

lewisje commented Oct 10, 2016

Also, in case anyone ports this to Safari: 9+ supports Map and Set very well, 7.1 and 8 support them fairly well, and older versions don't support them natively.

@gorhill gorhill closed this as completed Sep 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants