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

Increase search debounce timeout #1169

Merged
merged 1 commit into from Feb 3, 2019
Merged

Increase search debounce timeout #1169

merged 1 commit into from Feb 3, 2019

Conversation

ericcornelissen
Copy link
Contributor

Issue: #1089

Description

Increase debounce timeout from 50 to 200 in order to make search a bit less heavy on the end users computer. I tested values ranging from 100 to 1000, and 200 seemed to be the highest value at which the responsiveness still "felt good".

birjj pushed a commit that referenced this pull request Feb 3, 2019
* Improve performance of search on website

By reducing the number of times a search query loops over all icons or
all icons that match the search query (from 3 to 1 and 2 to 0
respectively) the search on simpleicons.org should now be noticeably
faster (if it was slow before). Especially in conjunction with #1169.

This was achieved by utilizing CSS (which operates faster then plain
JavaScript) to do most of the heavy lifting. A class on <body> now
dictates the order of the icons rather then a JavaScript for-loop (found
in the removed function `orderIcons`).

It was also achieved by more cleverly utilizing the fuzzy search logic
and recognizing that the CSS `order` property also works if number are
not consecutive. Less relevant numbers will have a higher value assigned
by fuzzy search, which is what the `order`-value of the icon will
become, removing the need for sorting and an additional loop.

Some resources that helped me:
- https://css-tricks.com/css-attr-function-got-nothin-custom-properties/
- https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables
    Specifically the "Values in JavaScript" section

* * *

One unrelated change in stylesheet.css where 2 separate rulesets for
.grid-item__link have been merged.

* Simplify script with regard to button states

* Reduce complexity of `previousQuery` variables
@birjj birjj merged commit b6a2ff1 into simple-icons:develop Feb 3, 2019
@ericcornelissen ericcornelissen deleted the site/debounce-timeout branch April 16, 2019 14:28
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

Successfully merging this pull request may close these issues.

None yet

3 participants