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

fix(benchmarks): benchmarks for store.query no longer included record… #4696

Merged
merged 2 commits into from
Dec 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addon/-private/system/model/internal-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export default class InternalModel {
getRecord() {
if (!this._record) {
heimdall.increment(materializeRecord);
let token = heimdall.start('InternalModel.getRecord');

// lookupFactory should really return an object that creates
// instances with the injections applied
Expand All @@ -285,6 +286,7 @@ export default class InternalModel {
this._record = this.modelClass._create(createOptions);

this._triggerDeferredTriggers();
heimdall.stop(token);
}

return this._record;
Expand Down
5 changes: 5 additions & 0 deletions tests/dummy/app/routes/query/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export default Route.extend({
let token = heimdall.start('ember-data');
return this.get('store').query(modelName, params)
.then((records) => {
// RecordArray lazily materializes the records
// We call toArray() to force materialization for benchmarking
// otherwise we would need to consume the RecordArray in our UI
// and clutter our benchmarks and make it harder to time.
records.toArray();
Copy link
Member

Choose a reason for hiding this comment

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

@runspired do you mind adding a comment explaining this line forces the materialization so we don't forget in the future?

heimdall.stop(token);
window.result = heimdall.toString();

Expand Down