Skip to content

Commit

Permalink
Fix benchmark tests (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Jun 20, 2019
1 parent 7f35618 commit 60f395b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 39 deletions.
42 changes: 18 additions & 24 deletions test/bench/core-layers.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,46 +71,34 @@ export default function coreLayersBench(suite) {
testInitializeLayer({layer});
})
.add('SolidPolygonLayer#initialize (flat)', () => {
const layer = new SolidPolygonLayer({data: data.choropleths.features});
const layer = new SolidPolygonLayer({
data: data.choropleths.features,
getPolygon: f => f.geometry.coordinates
});
testInitializeLayer({layer});
})
.add('SolidPolygonLayer#initialize (extruded)', () => {
const layer = new SolidPolygonLayer({
data: data.choropleths.features,
getPolygon: f => f.geometry.coordinates,
extruded: true
});
testInitializeLayer({layer});
})
.add('SolidPolygonLayer#initialize (wireframe)', () => {
const layer = new SolidPolygonLayer({
data: data.choropleths.features,
getPolygon: f => f.geometry.coordinates,
extruded: true,
wireframe: true
});
testInitializeLayer({layer});
})
.add('SolidPolygonLayer#initialize (flat,fp64)', () => {
const layer = new SolidPolygonLayer({data: data.choropleths.features, fp64: true});
testInitializeLayer({layer});
})
.add('SolidPolygonLayer#initialize (extruded,fp64)', () => {
const layer = new SolidPolygonLayer({
data: data.choropleths.features,
extruded: true,
fp64: true
});
testInitializeLayer({layer});
})
.add('SolidPolygonLayer#initialize (wireframe,fp64)', () => {
const layer = new SolidPolygonLayer({
data: data.choropleths.features,
extruded: true,
wireframe: true,
fp64: true
});
testInitializeLayer({layer});
})
.add('TextLayer#initialize', () => {
if (typeof document === 'undefined') {
// FontAtlasManager does not work in Node
return;
}
const layer = new TextLayer({
data: data.points,
getPosition: d => d.COORDINATES,
Expand Down Expand Up @@ -185,10 +173,16 @@ function layerConstructionBench(suite) {
return new GeoJsonLayer({data: data.choropleths});
})
.add('PolygonLayer#construct', () => {
return new PolygonLayer({data: data.choropleths.features});
return new PolygonLayer({
data: data.choropleths.features,
getPolygon: f => f.geometry.coordinates
});
})
.add('SolidPolygonLayer#construct', () => {
return new PolygonLayer({data: data.choropleths.features});
return new PolygonLayer({
data: data.choropleths.features,
getPolygon: f => f.geometry.coordinates
});
})
.add('ScatterplotLayer#construct(separate prop objects)', () => {
return new ScatterplotLayer(PROPS1, PROPS2, PROPS3);
Expand Down
29 changes: 15 additions & 14 deletions test/bench/tesselation.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ const polygons = data.choropleths.features.map(f => f.geometry.coordinates);
export default function tesselationBench(suite) {
return suite
.group('TESSELATOR')
.add('polygonTesselator.updatePositions#flat', () => {
const tesselator = new PolygonTesselator({polygons});
tesselator._updatePositions({});
.add('polygonTesselator.buildGeometry', () => {
// eslint-disable-next-line
new PolygonTesselator({
data: polygons,
getGeometry: d => d,
positionFormat: 'XYZ'
});
})
.add('polygonTesselator.updatePositions#extruded', () => {
const tesselator = new PolygonTesselator({polygons});
tesselator._updatePositions({extruded: true});
})
.add('polygonTesselator.updatePositions#flat - fp64', () => {
const tesselator = new PolygonTesselator({polygons});
tesselator._updatePositions({fp64: true});
})
.add('polygonTesselator.updatePositions#extruded - fp64', () => {
const tesselator = new PolygonTesselator({polygons});
tesselator._updatePositions({extruded: true, fp64: true});
.add('polygonTesselator.buildGeometry - fp64', () => {
// eslint-disable-next-line
new PolygonTesselator({
data: polygons,
getGeometry: d => d,
fp64: true,
positionFormat: 'XYZ'
});
});
}
2 changes: 1 addition & 1 deletion test/bench/utils.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/* eslint-disable no-console, no-invalid-this */

import {Layer, ScatterplotLayer, LineLayer} from 'deck.gl';
import {inheritsFrom} from '@deck.gl/core/utils/inherits-from';
import {inheritsFrom} from '@deck.gl/react/utils/inherits-from';

import {fp64} from '@luma.gl/core';
const {fp64ify, fp64LowPart} = fp64;
Expand Down

0 comments on commit 60f395b

Please sign in to comment.