Bug 177597 - Speedometer 2.0: Listen for changes to individual attributes in Backbone suite
Summary: Speedometer 2.0: Listen for changes to individual attributes in Backbone suite
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Blocks: 167652
  Show dependency treegraph
Reported: 2017-09-28 01:34 PDT by Shiyu Zhang
Modified: 2017-09-28 18:10 PDT (History)
4 users (show)

See Also:

Patch for backbone model change binding (2.20 KB, patch)
2017-09-28 01:34 PDT, Shiyu Zhang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shiyu Zhang 2017-09-28 01:34:59 PDT
Created attachment 322072 [details]
Patch for backbone model change binding

Backbone implementation used to trigger render function twice if a new item is created as reported in https://github.com/tastejs/todomvc/issues/469. A workaround is to filter out the render invocation caused by 'id' change as https://github.com/tastejs/todomvc/pull/755 did.

I think there is a more decent way to fix this issure by binding listeners to specific attributes change of the model. In this way, we only listen to the model attributes that we really care and ignore the 'id' change. It's also more efficient to write specific listeners for different model attributes ('completed' and 'title') change instead of re-rendering the whole todo item once the mode changes. The performance of backbone suite improved 8% after applying this patch.
Comment 1 Ryosuke Niwa 2017-09-28 18:10:46 PDT
No. Please stop making optimizations to the benchmark.

We shouldn't be making the benchmark faster. We should be making the browser engines faster.