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

Don't use locale-aware comparison for browser names #123

Merged
merged 1 commit into from Feb 18, 2017

Conversation

akx
Copy link
Contributor

@akx akx commented Feb 17, 2017

I used 0x to look at the flamegraphs for (you guessed it!) a CSS build, and found out a lot of time was spent sorting the browser list.

It might be a good idea to add an option to disable the sorting, since many use cases don't really need a prettily sorted list anyway?

Anyway, I don't think there's a good reason to use the collation-aware String.localeCompare() method for comparing browser names, which are always in ASCII.

Performance impact

Using this highly synthetic benchmark which simply calls the browserlist() function 10,000 times, this branch is 28% faster than 1.7.3.

$ time node -e 'bl=require(".");for(i=0;i<10000;i++){bl([">1%"])}'
  • master (19b3610): 1.44 seconds
  • no-locale-compare: (196c739): 1.12 seconds

@ai
Copy link
Member

ai commented Feb 17, 2017

Wow, great! We could release it in patch version.

I am doing to drink right now. So I will accept PR and release it only tomorrow. But it looks awesome, thanks!

@akx
Copy link
Contributor Author

akx commented Feb 17, 2017

We're already on it here! :)

За здоровье! 😄

photo on 17-02-2017 at 16 09

@ai ai merged commit 819ad3b into browserslist:master Feb 18, 2017
@akx akx deleted the no-locale-compare branch February 18, 2017 11:51
@ai
Copy link
Member

ai commented Feb 18, 2017

Thanks. Released in 1.7.4.

zhouyu9527 pushed a commit to zhouyu9527/browserslist that referenced this pull request Jul 5, 2022
tats-u pushed a commit to tats-u/browserslist that referenced this pull request Apr 8, 2023
…yarn/caniuse-db-1.0.30000988

Update caniuse-db requirement from 1.0.30000984 to 1.0.30000988
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