Skip to content

Commit

Permalink
Fix benchmarks (#3908)
Browse files Browse the repository at this point in the history
* Fixes benchmark creation code

* Remove unwnated change, lint
  • Loading branch information
HarelM committed Mar 26, 2024
1 parent 816f898 commit 8e8d020
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test/bench/rollup/benchmarks_styles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import '../../../staging/benchmarks/styles/shared';
import '../../../staging/benchmarks/styles/worker';
import '../../../staging/benchmarks/styles/benchmarks';
import '../../../staging/benchmarks/styles/index';
2 changes: 1 addition & 1 deletion test/bench/rollup/benchmarks_versions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import '../../../staging/benchmarks/versions/shared';
import '../../../staging/benchmarks/versions/worker';
import '../../../staging/benchmarks/versions/benchmarks';
import '../../../staging/benchmarks/versions/index';
13 changes: 11 additions & 2 deletions test/bench/rollup_config_benchmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import typescript from '@rollup/plugin-typescript';
import {execSync} from 'child_process';
import {RollupOptions} from 'rollup';

/**
* This script generates the benchmark bundles for the benchmark suite.
* It does it by replacing the index.ts file of maplibre-gl-js with a local index.ts file that registers the releavnt benchmarks.
* The thing to note here is that the index.ts file of the benchmarks needs to export the same thing the originla index.ts file is exporting.
*/

let styles = ['https://api.maptiler.com/maps/streets/style.json?key=get_your_own_OpIi9ZULNHzrESv6T2vL'];

if (process.env.MAPLIBRE_STYLES) {
Expand All @@ -30,13 +36,16 @@ const allPlugins = plugins(true).concat(replace(replaceConfig));
const intro = fs.readFileSync('build/rollup/bundle_prelude.js', 'utf8');

const splitConfig = (name: string): RollupOptions[] => [{
input: [`test/bench/${name}/benchmarks.ts`, 'src/source/worker.ts'],
input: [`test/bench/${name}/index.ts`, 'src/source/worker.ts'],
output: {
dir: `staging/benchmarks/${name}`,
format: 'amd',
indent: false,
sourcemap: 'inline',
chunkFileNames: 'shared.js'
chunkFileNames: 'shared.js',
amd: {
autoId: true,
},
},
plugins: allPlugins
}, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as maplibregl from '../../../src/';
import locationsWithTileID from '../lib/locations_with_tile_id';
import styleBenchmarkLocations from '../data/style-benchmark-locations.json' assert {type: 'json'};
import StyleLayerCreate from '../benchmarks/style_layer_create';
Expand Down Expand Up @@ -41,4 +40,4 @@ Promise.resolve().then(() => {
getGlobalWorkerPool().acquire(-1);
});

export default maplibregl;
export * from '../../../src';
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as maplibregl from '../../../src';
import locationsWithTileID from '../lib/locations_with_tile_id';
import styleBenchmarkLocations from '../data/style-benchmark-locations.json' assert {type: 'json'};
import Layout from '../benchmarks/layout';
Expand Down Expand Up @@ -83,4 +82,4 @@ Promise.resolve().then(() => {
getGlobalWorkerPool().acquire(-1);
});

export default maplibregl;
export * from '../../../src';

0 comments on commit 8e8d020

Please sign in to comment.