(August 12, 2022 at 4:37 pm)HappySkeptic Wrote:(August 12, 2022 at 1:41 pm)FlatAssembler Wrote: Whence am I supposed to know all those things? I am just a third-year computer science student. And I have also been using a hell lots of things we haven't been taught at the university in my program.
A performance test is just a test program. It could be part of a unit-test. Just have it do something in a loop 1000 times (or some large-enough number). In Javascript
Code:var start = performance.now();
const iterations = 1000;
for (let i = 0; i < iterations; i++) {
// Do some testing work
}
var stop = performance.now();
console.log("Test 1 runs in " + ((stop - start)/iterations) + " ms.");
You said your program is "slow". How do you know? You must have expectations. At least this way you can check if something is slow or not, and find out if you fixed it or not, by comparing these numbers.
If something is slow, do a bunch of work in the loop, and do performance timing using the F12 developer console Performance tab in Chrome. You can start the recording from some "pause" point in your code, or you can start it with a page reload, and stop it when your code has finished. Look for the bottom-up methods, and check for calls that use a majority of the time.
Yeah. I have done some unit tests in the AEC-to-WebAssembly compiler, but I made no unit tests in the PicoBlaze Simulator, nor would I know how exactly to do those there.