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

Perf #9

Closed
wants to merge 1 commit into from
Closed

Perf #9

wants to merge 1 commit into from

Conversation

andrejborstnik
Copy link
Collaborator

@andrejborstnik andrejborstnik commented Jun 3, 2020

Slightly improves perf by:

  • skipping an unnecessary loop
  • skipping an unnecessary object expansion

Measurements using https://github.com/andrejborstnik/benchmark. Big variance in results, but after is consistently faster, as expected.

Before:
Screenshot 2020-06-04 at 01 25 27

After:
Screenshot 2020-06-04 at 01 43 07

@andrejborstnik andrejborstnik added the enhancement New feature or request label Jun 3, 2020
@andrejborstnik andrejborstnik requested a review from sonaye June 3, 2020 23:45
@andrejborstnik andrejborstnik self-assigned this Jun 3, 2020
@andrejborstnik andrejborstnik requested a review from mvayngrib June 4, 2020 15:09
Copy link

@mvayngrib mvayngrib left a comment

Choose a reason for hiding this comment

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

utACK

const fixedStyleProps = multi ? fixedStyle : { style: fixedStyle }
const fixedStyleKeys = Object.keys(fixedStyleProps)

for (let i = 0; i < fixedStyleKeys.length; i += 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are assuming styleKeys.length is equal fixedStyleKeys.length?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice catch, that is a bug, will update

@andrejborstnik
Copy link
Collaborator Author

After fixing #9 (comment) I no longer see significant perf gains, so not worth changing without evaluating on the cases in our app. Will close as future for now.

@sonaye sonaye deleted the perf branch June 8, 2020 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants