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 and refactor the benchmark suite #8066

Merged
merged 16 commits into from
Mar 23, 2019
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
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ jobs:
name: Build
command: BENCHMARK_VERSION="${CIRCLE_TAG:-$CIRCLE_BRANCH} $(git rev-parse --short=7 HEAD)" yarn run build-benchmarks
- run:
name: Upload
name: Upload benchmark
command: aws s3 cp --acl public-read --content-type application/javascript bench/versions/benchmarks_generated.js s3://mapbox-gl-js/${CIRCLE_TAG:-$CIRCLE_BRANCH}/benchmarks.js
- run:
name: Upload source maps
command: aws s3 cp --acl public-read --content-type application/javascript bench/versions/benchmarks_generated.js.map s3://mapbox-gl-js/${CIRCLE_TAG:-$CIRCLE_BRANCH}/benchmarks.js.map

deploy-release:
<<: *defaults
Expand Down
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ coverage
flow-coverage
.DS_Store
.nyc_output
bench/versions/benchmarks_generated.js
bench/versions/benchmarks_view_generated.js
bench/styles/benchmarks_generated.js
bench/styles/benchmarks_view_generated.js
debug/access_token_generated.js
debug/style_property_editor_generated.js
*_generated.js
*_generated.js.map
test/integration/**/index*.html
test/integration/**/actual.png
test/integration/**/actual.json
Expand Down
18 changes: 5 additions & 13 deletions bench/benchmarks/expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,50 +71,42 @@ class ExpressionBenchmark extends Benchmark {
}
}

class FunctionCreate extends ExpressionBenchmark {
export class FunctionCreate extends ExpressionBenchmark {
bench() {
for (const {rawValue, propertySpec} of this.data) {
createFunction(rawValue, propertySpec);
}
}
}

class FunctionEvaluate extends ExpressionBenchmark {
export class FunctionEvaluate extends ExpressionBenchmark {
bench() {
for (const {compiledFunction} of this.data) {
compiledFunction.evaluate({zoom: 0});
}
}
}

class FunctionConvert extends ExpressionBenchmark {
export class FunctionConvert extends ExpressionBenchmark {
bench() {
for (const {rawValue, propertySpec} of this.data) {
convertFunction(rawValue, propertySpec);
}
}
}

class ExpressionCreate extends ExpressionBenchmark {
export class ExpressionCreate extends ExpressionBenchmark {
bench() {
for (const {rawExpression, propertySpec} of this.data) {
createPropertyExpression(rawExpression, propertySpec);
}
}
}

class ExpressionEvaluate extends ExpressionBenchmark {
export class ExpressionEvaluate extends ExpressionBenchmark {
bench() {
for (const {compiledExpression} of this.data) {
compiledExpression.evaluate({zoom: 0});
}
}
}

export default [
FunctionCreate,
FunctionConvert,
FunctionEvaluate,
ExpressionCreate,
ExpressionEvaluate
];
33 changes: 10 additions & 23 deletions bench/benchmarks/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function generateLayers(layer) {
return generated;
}

class LayerBenchmark extends Benchmark {
export class LayerBenchmark extends Benchmark {
setup() {
return createMap({
zoom: 16,
Expand All @@ -37,7 +37,7 @@ class LayerBenchmark extends Benchmark {
}
}

class LayerBackground extends LayerBenchmark {
export class LayerBackground extends LayerBenchmark {
constructor() {
super();

Expand All @@ -50,7 +50,7 @@ class LayerBackground extends LayerBenchmark {
}
}

class LayerCircle extends LayerBenchmark {
export class LayerCircle extends LayerBenchmark {
constructor() {
super();

Expand All @@ -65,7 +65,7 @@ class LayerCircle extends LayerBenchmark {
}
}

class LayerFill extends LayerBenchmark {
export class LayerFill extends LayerBenchmark {
constructor() {
super();

Expand All @@ -84,7 +84,7 @@ class LayerFill extends LayerBenchmark {
}
}

class LayerFillExtrusion extends LayerBenchmark {
export class LayerFillExtrusion extends LayerBenchmark {
constructor() {
super();

Expand All @@ -102,7 +102,7 @@ class LayerFillExtrusion extends LayerBenchmark {
}
}

class LayerHeatmap extends LayerBenchmark {
export class LayerHeatmap extends LayerBenchmark {
setup() {
return fetch('/bench/data/naturalearth-land.json')
.then(response => response.json())
Expand Down Expand Up @@ -144,7 +144,7 @@ class LayerHeatmap extends LayerBenchmark {
}
}

class LayerHillshade extends LayerBenchmark {
export class LayerHillshade extends LayerBenchmark {
constructor() {
super();

Expand All @@ -164,7 +164,7 @@ class LayerHillshade extends LayerBenchmark {
}
}

class LayerLine extends LayerBenchmark {
export class LayerLine extends LayerBenchmark {
constructor() {
super();

Expand All @@ -179,7 +179,7 @@ class LayerLine extends LayerBenchmark {
}
}

class LayerRaster extends LayerBenchmark {
export class LayerRaster extends LayerBenchmark {
constructor() {
super();

Expand All @@ -200,7 +200,7 @@ class LayerRaster extends LayerBenchmark {
}
}

class LayerSymbol extends LayerBenchmark {
export class LayerSymbol extends LayerBenchmark {
constructor() {
super();

Expand All @@ -218,16 +218,3 @@ class LayerSymbol extends LayerBenchmark {
});
}
}


export default [
LayerBackground,
LayerCircle,
LayerFill,
LayerFillExtrusion,
LayerHeatmap,
LayerHillshade,
LayerLine,
LayerRaster,
LayerSymbol
];
12 changes: 4 additions & 8 deletions bench/benchmarks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ export default class Layout extends Benchmark {
tiles: Array<{tileID: OverscaledTileID, buffer: ArrayBuffer}>;
parser: TileParser;
style: string | StyleSpecification;
locations: Array<OverscaledTileID>;
tileIDs: Array<OverscaledTileID>;

constructor(style: string | StyleSpecification, locations: ?Array<OverscaledTileID>) {
constructor(style: string | StyleSpecification, tileIDs: ?Array<OverscaledTileID>) {
super();
this.style = style;
this.locations = locations || this.tileIDs();
}

tileIDs(): Array<OverscaledTileID> {
return [
this.tileIDs = tileIDs || [
new OverscaledTileID(12, 0, 12, 655, 1583),
new OverscaledTileID(8, 0, 8, 40, 98),
new OverscaledTileID(4, 0, 4, 3, 6),
Expand All @@ -34,7 +30,7 @@ export default class Layout extends Benchmark {
return this.parser.setup();
})
.then(() => {
return Promise.all(this.locations.map(tileID => this.parser.fetchTile(tileID)));
return Promise.all(this.tileIDs.map(tileID => this.parser.fetchTile(tileID)));
})
.then((tiles) => {
this.tiles = tiles;
Expand Down
12 changes: 3 additions & 9 deletions bench/benchmarks/remove_paint_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RemovePaintState extends Benchmark {
}
}

class PropertyLevelRemove extends RemovePaintState {
export class PropertyLevelRemove extends RemovePaintState {
bench() {

for (let i = 0; i < this.numFeatures; i += 50) {
Expand All @@ -82,7 +82,7 @@ class PropertyLevelRemove extends RemovePaintState {
}
}

class FeatureLevelRemove extends RemovePaintState {
export class FeatureLevelRemove extends RemovePaintState {
bench() {

for (let i = 0; i < this.numFeatures; i += 50) {
Expand All @@ -96,7 +96,7 @@ class FeatureLevelRemove extends RemovePaintState {
}
}

class SourceLevelRemove extends RemovePaintState {
export class SourceLevelRemove extends RemovePaintState {
bench() {

for (let i = 0; i < this.numFeatures; i += 50) {
Expand All @@ -109,9 +109,3 @@ class SourceLevelRemove extends RemovePaintState {

}
}

export default [
PropertyLevelRemove,
FeatureLevelRemove,
SourceLevelRemove
];
Loading