Skip to content

Commit

Permalink
Stub out Map#_rerender in paint benchmarks
Browse files Browse the repository at this point in the history
Fixes #5543. Internal rendering changes were causing one of the conditions on the call to _rerender inside _render to be true, whereas before it was apparently always false. _rerender caused an animation frame to be requested, but then the resulting frameId would be reset via the benchmark's own call to _render. The result was a backlog of animation frame requests, some of which completed after teardown.
  • Loading branch information
jfirebaugh committed Oct 30, 2017
1 parent 0bca909 commit 3021803
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bench/benchmarks/layers.js
Expand Up @@ -13,6 +13,8 @@ class LayerBenchmark extends Benchmark {
style: this.layerStyle
}).then(map => {
this.map = map;
// Stub out `_rerender`; we want to be the only trigger of `_render`.
this.map._rerender = () => {};
});
}

Expand Down
8 changes: 7 additions & 1 deletion bench/benchmarks/paint.js
Expand Up @@ -16,7 +16,13 @@ module.exports = class Paint extends Benchmark {
center: [-77.032194, 38.912753],
style: 'mapbox://styles/mapbox/streets-v9'
});
})).then(maps => { this.maps = maps; });
})).then(maps => {
this.maps = maps;
for (const map of this.maps) {
// Stub out `_rerender`; we want to be the only trigger of `_render`.
map._rerender = () => {};
}
});
}

bench() {
Expand Down

0 comments on commit 3021803

Please sign in to comment.