Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Issue: #1089
Description
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>
nowdictates 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 numbers arenot consecutive. Less relevant icons will have a higher value assigned
by fuzzy search, which is what the
order
-value of the icon willbecome, removing the need for sorting and an additional loop.
Some resources that helped me:
PS. there are a few minor unrelated changes (specifically this, but more), my apologies