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 init performance #1687

Closed
wants to merge 2 commits into from
Closed

Conversation

andrews05
Copy link

@andrews05 andrews05 commented Mar 25, 2017

This PR improves initialisation performance in two ways:

  1. Changes detection of first optgroup option from $this.index() === 0 to !this.previousElementSibling. This makes a huge difference for large optgroups.
  2. Sets necessary selected/disabled attributes during li creation, so the render doesn't have to update them during init/refresh.
  3. Listens for focus on the select element instead of finding labels. This has the added advantage of also working for implicit labels.

I found this improved speed by a minimum of 2x with no optgroups, but over 10x for an optgroup with 2k options.

@andrews05
Copy link
Author

One thing I wasn't quite sure about: The setDisabled function sets href to '#' if disabled and removes href if enabled. Is this correct or should it be the other way around?

caseyjhol added a commit that referenced this pull request Jul 20, 2017
@caseyjhol caseyjhol added this to the v1.13.0 milestone Jul 20, 2017
@caseyjhol
Copy link
Member

@andrews05 That's a good question. My guess is it was supposed to be the other way around (added in b689ac6). I don't really see a purpose for it, so I'll remove enabling/disabling href in the next release.

@caseyjhol
Copy link
Member

Available in v1.13.0-alpha.

@caseyjhol caseyjhol closed this Jul 29, 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

Successfully merging this pull request may close these issues.

None yet

2 participants