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

Revert "Move bench to ES modules" #969

Merged
merged 1 commit into from
Feb 8, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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