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

[Flow] Add missing export types to bench/* #11487

Merged
merged 1 commit into from
Feb 9, 2022
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: 1 addition & 1 deletion bench/benchmarks/expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ExpressionBenchmark extends Benchmark {
this.style = style;
}

setup() {
setup(): Promise<void> {
return fetchStyle(this.style)
.then(json => {
this.data = [];
Expand Down
2 changes: 1 addition & 1 deletion bench/benchmarks/hillshade_load.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class HillshadeLoad extends Benchmark {
};
}

bench() {
bench(): Promise<void> {
return createMap({
width: 1024,
height: 1024,
Expand Down
2 changes: 1 addition & 1 deletion bench/benchmarks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Layout extends Benchmark {
.then(() => {});
}

bench() {
bench(): Promise<void> {
let promise = Promise.resolve();
for (const tile of this.tiles) {
promise = promise.then(() => {
Expand Down
2 changes: 1 addition & 1 deletion bench/benchmarks/layout_dds.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class LayoutDDS extends Benchmark {
.then(() => {});
}

bench() {
bench(): Promise<void> {
let promise = Promise.resolve();
for (const tile of this.tiles) {
promise = promise.then(() => {
Expand Down
2 changes: 1 addition & 1 deletion bench/benchmarks/symbol_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class SymbolLayout extends Layout {
});
}

bench() {
bench(): Promise<void> {
let promise = Promise.resolve();
for (const tileResult of this.parsedTiles) {
promise = promise.then(() => {
Expand Down
7 changes: 4 additions & 3 deletions bench/lib/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Benchmark {
});
}

_done() {
_done(): boolean {
// 210 samples => 20 observations for regression
return this._elapsed >= 500 && this._measurements.length > 210;
}
Expand All @@ -76,7 +76,7 @@ class Benchmark {
}
}

_measureSync() {
_measureSync(): Promise<Array<Measurement>> {
// Avoid Promise overhead for sync benchmarks.
while (true) {
const time = performance.now() - this._start;
Expand All @@ -87,13 +87,14 @@ class Benchmark {
this._measurements.push({time, iterations: this._iterationsPerMeasurement});
}
if (this._done()) {
return this._end();
break;
}
this._start = performance.now();
for (let i = this._iterationsPerMeasurement; i > 0; --i) {
this.bench();
}
}
return this._end();
}

_measureAsync(): Promise<Array<Measurement>> {
Expand Down
2 changes: 1 addition & 1 deletion bench/lib/tile_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default class TileParser {
});
}

fetchTile(tileID: OverscaledTileID) {
fetchTile(tileID: OverscaledTileID): Promise<{| buffer: ArrayBuffer, tileID: OverscaledTileID |}> {
return fetch(this.style.map._requestManager.normalizeTileURL(tileID.canonical.url(this.tileJSON.tiles)))
.then(response => response.arrayBuffer())
.then(buffer => ({tileID, buffer}));
Expand Down