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

Improve speed of css selector lookup for large stylesheets #10

Open
Oudwins opened this issue Jan 12, 2024 · 0 comments
Open

Improve speed of css selector lookup for large stylesheets #10

Oudwins opened this issue Jan 12, 2024 · 0 comments
Assignees

Comments

@Oudwins
Copy link
Owner

Oudwins commented Jan 12, 2024

Currently to check if a selector exists we look at each element. This may be slow for large stylesheets

There are a few ways we could improve the lookup speed but I have not yet decide on the best approach:

  1. Some how sorting the rules array on each insert allowing a binary search to be performed for each lookup
    This would require a way to sort any css selector while keeping all media queries at the bottom of the array (this is a must)

  2. Since css selectors in Dstyler must be unique on each scope. We may keep a selector->ast_rule_node hashmap for O(1) lookups

Both options have their tradeoffs

@Oudwins Oudwins self-assigned this Jan 12, 2024
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

1 participant