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] flatten DS.Model to avoid multi-extend, expensive reopens, and extra mixin detection #4701

Merged
merged 13 commits into from
Dec 7, 2016

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Dec 6, 2016

Replaces #4667 with a version that takes more commits so we preserve more of the history of where code came from.

Perf

We see some improvement in both the areas we expect (initial lookup, materialization), there may also be a modest 2-5% improvement in several other areas but I'm skeptical. I want to run more test runs on this, and I'd like @stefanpenner to put it in our app with me tomorrow and measure in the real world.

initial-modelFor-lookup

Master

{
  "min": "1.75",
  "q1": "2.18",
  "q2": "2.40",
  "q3": "2.83",
  "max": "3.30",
  "avg": "2.48"
}

PR

{
  "min": "1.80",
  "q1": "2.08",
  "q2": "2.14",
  "q3": "2.5",
  "max": "3.03",
  "avg": "2.33"
}

InternalModel.getRecord (238 total calls)

Master

{
  "min": "6.84",
  "q1": "7.67",
  "q2": "9.36",
  "q3": "11.92",
  "max": "15.33",
  "avg": "9.94"
}

PR

{
  "min": "6.60",
  "q1": "7.63",
  "q2": "8.17",
  "q3": "9.05",
  "max": "11.70",
  "avg": "8.49"
}

@runspired runspired changed the title [WIP] Feat/flattened ds model [PERF] flatten DS.Model to avoid multi-extend, expensive reopens, and extra mixin detection Dec 7, 2016
@runspired
Copy link
Contributor Author

runspired commented Dec 7, 2016

I'm skeptical of the benchmark numbers above, I think I may be getting trolled but haven't figured out where yet. However, I spent some time in the profiler and it's fairly clear that this change is a 40% win for the initial parse of DS.Model.

Before
before-flattened-model

After
after-flattened-model

@runspired
Copy link
Contributor Author

Obviously a secondary benefit of all this is a much cleaner flame chart for spotting where to optimize things in the future as well.

}
},

//Calculate the inverse, ignoring the cache
Copy link
Member

Choose a reason for hiding this comment

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

I think jscs usually complains about a lack of space

Copy link
Member

Choose a reason for hiding this comment

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

But this is probably old code

@igorT igorT merged commit 7d14d16 into emberjs:master Dec 7, 2016
@stefanpenner
Copy link
Member

@runspired thanks for the annotated screenshot, it is very easy to now identify exactly what you saw :)

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

3 participants