File size: 739 Bytes
f65fe85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

const fs = require("fs")
const lilypond = require("../output/lilypond");



const engrave = code => lilypond.engrave(code, {
	onSVG (filename) {
		console.log("SVG received:", filename);
	},
	onMIDI (filename) {
		console.log("MIDI received:", filename);
	},
});


const main = async (filename, times = 3) => {
	times = Number(times);

	console.log("[profiler] begin.");

	const code = fs.readFileSync(filename);
	const t00 = Date.now();
	let t0 = t00;

	for (let i = 0; i < times; ++i) {
		await engrave(code);

		const t1 = Date.now();
		console.log(`[profiler] engrave.${i + 1}`, t1 - t0);

		t0 = t1;
	}

	const total = Date.now() - t00;
	console.log("[profiler] summary:", total, total / times);
};


main(...process.argv.slice(2));