Skip to content

Commit

Permalink
Revert "Move benchmarks to ES modules (#964)"
Browse files Browse the repository at this point in the history
This reverts commit aa8ed9d.
  • Loading branch information
birkskyum committed Feb 8, 2022
1 parent 151bc9d commit c0dde32
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions bench/rollup_config_benchmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const splitConfig = (name: string): RollupOptions[] => [{
input: [`${srcDir}bench/${name}/benchmarks.${inputExt}`, `${srcDir}src/source/worker.${inputExt}`],
output: {
dir: `rollup/build/benchmarks/${name}`,
format: 'es',
format: 'amd',
indent: false,
sourcemap: 'inline',
chunkFileNames: 'shared.js'
Expand All @@ -48,7 +48,7 @@ const splitConfig = (name: string): RollupOptions[] => [{
input: `rollup/benchmarks_${name}.js`,
output: {
file: `bench/${name}/benchmarks_generated.js`,
format: 'es',
format: 'umd',
indent: false,
sourcemap: true,
intro
Expand All @@ -62,7 +62,7 @@ const viewConfig: RollupOptions = {
output: {
name: 'Benchmarks',
file: 'bench/benchmarks_view_generated.js',
format: 'es',
format: 'umd',
indent: false,
sourcemap: false
},
Expand Down
10 changes: 4 additions & 6 deletions bench/styles/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

<body>
<div id="benchmarks"></div>

<script type="module">
await import('/bench/styles/benchmarks_generated.js');
const {run} = await import('/bench/benchmarks_view_generated.js');

run(benchmarks);
<script src="/bench/styles/benchmarks_generated.js"></script>
<script src="/bench/benchmarks_view_generated.js"></script>
<script>
window.Benchmarks.run(benchmarks);
</script>
</body>

Expand Down
8 changes: 3 additions & 5 deletions bench/versions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

<body>
<div id="benchmarks"></div>
<!-- <script type="module" src="/bench/benchmarks_view_generated.js"></script> -->
<script type="module">
const {run} = await import('/bench/benchmarks_view_generated.js');
<script src="/bench/benchmarks_view_generated.js"></script>
<script>
runComparison();

async function runComparison() {
Expand Down Expand Up @@ -53,7 +52,7 @@
benchmarks.push({name, versions});
}

const results = await run(benchmarks);
const results = await window.Benchmarks.run(benchmarks);
// eslint-disable-next-line require-atomic-updates
window.maplibreglBenchmarkResults = {};
for (const result of results) {
Expand All @@ -73,7 +72,6 @@
return new Promise((resolve, reject) => {
const s = document.createElement('script');
s.src = src;
s.type = 'module';
s.onload = resolve;
s.onerror = reject;
document.head.appendChild(s);
Expand Down

0 comments on commit c0dde32

Please sign in to comment.