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 c527360
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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
10 changes: 8 additions & 2 deletions bench/benchmarks/paint.js
Expand Up @@ -4,7 +4,7 @@ const createMap = require('../lib/create_map');

const width = 1024;
const height = 768;
const zooms = [4, 8, 11, 13, 15, 17];
const zooms = [4];

module.exports = class Paint extends Benchmark {
setup() {
Expand All @@ -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 c527360

Please sign in to comment.