Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Optimize URL bar history and bookmark suggestions (generateNewSuggestionsList()) #8692

Merged
merged 1 commit into from
May 4, 2017

Conversation

ayumi
Copy link
Contributor

@ayumi ayumi commented May 4, 2017

Related to #7453

With 10,000 sites, time to run generateNewSuggestionsList():

  • Autocomplete history and bookmarks Enabled:
    • Existing (33e3fca): 170 ms
    • New: 38 ms
  • Autocomplete history and bookmarks Disabled:
    • Existing: 120 ms
    • New: 3 ms

Auditors: @darkdh @bbondy

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Test Plan:

  • Run tests: npm run test -- --grep="^urlBarSuggestions"

@ayumi ayumi requested review from bbondy and darkdh May 4, 2017 08:33
@ayumi ayumi changed the title Optimize URL bar history and bookmark suggestions Optimize URL bar history and bookmark suggestions (generateNewSuggestionsList()) May 4, 2017
@NejcZdovc NejcZdovc added this to the 0.15.3 milestone May 4, 2017
@ayumi ayumi force-pushed the fix/url-bar-autocomplete branch 2 times, most recently from c3fadb9 to e019197 Compare May 4, 2017 18:51
@ayumi ayumi self-assigned this May 4, 2017
let bookmarkSites = new Immutable.List()
const sites = appStoreRenderer.state.get('sites')
sites.forEach(site => {
if (!sitesFilter(site)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: this is most important change, to filter out non-matching sites as soon as possible to avoid downstream property lookup

return false
}
const title = site.get('title')
return location.toLowerCase().includes(urlLocationLower) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our discussion on Slack, I wonder if this could be sped up using indexOf? Link you shared: https://jsperf.com/regexp-test-vs-string-includes-vs-string-indexof

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! i've updated this PR to use indexOf instead of includes.

@ayumi ayumi force-pushed the fix/url-bar-autocomplete branch from e019197 to 90c5b2d Compare May 4, 2017 22:31
Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ayumi ayumi merged commit c002e3f into master May 4, 2017
@ayumi ayumi deleted the fix/url-bar-autocomplete branch May 4, 2017 23:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants