Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(perf) - move the collapser check before inling properties #773

Merged
merged 1 commit into from
Dec 30, 2017
Merged

Conversation

vigneshshanmugam
Copy link
Member

This yields us a huge 3.5x improvement on a test file > 2MB.

pluginAlias                       time(ms)

// Before
transform-inline-consecutive-adds - 5716.129
transform-inline-consecutive-adds - 5752.153
transform-inline-consecutive-adds - 5813.064

// After
transform-inline-consecutive-adds - 1624.955
transform-inline-consecutive-adds - 1925.298
transform-inline-consecutive-adds - 1788.473

Thanks to chrome devtools for helping to find the root cause. Confirmation from devtools

Before

screen shot 2017-12-29 at 22 16 38

After

screen shot 2017-12-29 at 22 27 23

@vigneshshanmugam vigneshshanmugam added the perf Topics related to Performance label Dec 29, 2017
@sophiebits
Copy link

sophiebits commented Dec 29, 2017

.get('body') creating an array seems like a huge performance trap @hzoo. Same thing I ran into in babel/babel#7028.

@vigneshshanmugam
Copy link
Member Author

Thanks @sophiebits for pointing out. Good to know. I am also seeing smaller perf slowdown on get calls from path not just on 'body'. It happens on all array elements

Probably it has something to do with https://github.com/babel/babel/blob/068c65a1dd5bf606d0441506f2f5773be168223b/packages/babel-traverse/src/path/family.js#L104

@sophiebits
Copy link

Yes.

Copy link
Member

@boopathi boopathi left a comment

Choose a reason for hiding this comment

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

Awesome!.

@boopathi boopathi merged commit 5ee3078 into master Dec 30, 2017
@boopathi boopathi deleted the perf-1 branch December 30, 2017 15:05
@boopathi boopathi added the Tag: Polish Pull Request for formatting, style changes, code cleanups, comments etc... label Dec 30, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
perf Topics related to Performance Tag: Polish Pull Request for formatting, style changes, code cleanups, comments etc...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants