2024-06-19 19:33:53 +02:00
|
|
|
import * as $ from '../packages/svelte/src/internal/client/index.js';
|
2024-06-20 11:05:11 +02:00
|
|
|
import { benchmarks } from './benchmarks.js';
|
2024-06-19 19:33:53 +02:00
|
|
|
|
2024-06-20 11:05:11 +02:00
|
|
|
let total_time = 0;
|
|
|
|
let total_gc_time = 0;
|
2024-06-19 19:33:53 +02:00
|
|
|
|
2024-06-20 11:05:11 +02:00
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log('-- Benchmarking Started --');
|
|
|
|
$.push({}, true);
|
|
|
|
try {
|
|
|
|
for (const benchmark of benchmarks) {
|
|
|
|
const results = await benchmark();
|
2024-06-19 21:52:20 +02:00
|
|
|
// eslint-disable-next-line no-console
|
2024-06-20 11:05:11 +02:00
|
|
|
console.log(results);
|
|
|
|
total_time += Number(results.time);
|
|
|
|
total_gc_time += Number(results.gc_time);
|
2024-06-19 19:33:53 +02:00
|
|
|
}
|
2024-06-20 11:05:11 +02:00
|
|
|
} catch (e) {
|
2024-06-19 19:33:53 +02:00
|
|
|
// eslint-disable-next-line no-console
|
2024-06-20 11:05:11 +02:00
|
|
|
console.error('-- Benchmarking Failed --');
|
2024-06-20 10:47:35 +02:00
|
|
|
// eslint-disable-next-line no-console
|
2024-06-20 11:05:11 +02:00
|
|
|
console.error(e);
|
|
|
|
process.exit(1);
|
2024-06-19 19:33:53 +02:00
|
|
|
}
|
2024-06-20 11:05:11 +02:00
|
|
|
$.pop();
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log('-- Benchmarking Complete --');
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log({
|
|
|
|
total_time: total_time.toFixed(2),
|
|
|
|
total_gc_time: total_gc_time.toFixed(2)
|
|
|
|
});
|