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

Optimize isScrollable() #2755

Merged
merged 6 commits into from
Jan 10, 2023
Merged

Optimize isScrollable() #2755

merged 6 commits into from
Jan 10, 2023

Conversation

dwilsonactual
Copy link
Contributor

@dwilsonactual dwilsonactual commented Jan 9, 2023

Take advantage of short-circuiting to not call getComputedStyle() if we don't have to.

For rendering a blob view page, this reduced the cumulative time taken by isScrollable() on my machine from ~10ms to ~5ms.

Screenshots

n/a

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@dwilsonactual dwilsonactual requested review from a team and broccolinisoup January 9, 2023 21:21
@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2023

🦋 Changeset detected

Latest commit: c06b5bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Just left a minor comment on the changeset

.changeset/nervous-apricots-search.md Outdated Show resolved Hide resolved
Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

This is great improvement, thanks!

@joshblack joshblack enabled auto-merge (squash) January 10, 2023 18:50
@joshblack joshblack merged commit dd1e5ce into primer:main Jan 10, 2023
@primer-css primer-css mentioned this pull request Jan 10, 2023
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.

3 participants