Conversation
11ab3c4 to
142589c
Compare
resources/benchmark-runner.mjs
Outdated
| let syncTime; | ||
| let asyncStartTime; | ||
| let asyncTime; | ||
| const invokerClass = params.measurementMethod === 'raf' ? RAFTestInvoker : TimerTestInvoker; |
|
Modulo function-names / bind comment. Looking good! |
resources/benchmark-runner.mjs
Outdated
| let asyncStartTime; | ||
| let asyncTime; | ||
| const invokerClass = params.measurementMethod === 'raf' ? RAFTestInvoker : TimerTestInvoker; | ||
| const invoker = new invokerClass(() => { |
There was a problem hiding this comment.
As on the other PR, maybe named-methods + bind makes this more readable?
There was a problem hiding this comment.
What do you mean by that? Could you show me an example?
There was a problem hiding this comment.
Along these lines (implying moving the *time values onto the class):
const invoker = new invokerClass(this.measureSync.bind(this), this.measureAsync.bind(this), this._report.bind(this));
...
}
measureSync(...) {
...
}
measureAsync(...) {
...
}
...
Maybe easier: using named arrow functions would be an improvement:
...
const syncStart = () => {...};
const measureAsync = () => {...};
const report = () => {...};
const invoker = new invokerClass(measureSync, measureAsync, report);
There was a problem hiding this comment.
.bind() makes it harder to read ;)
But that latter case looks better to me.
| return this._recordTestResults(suite, test, syncTime, asyncTime); | ||
| }); | ||
|
|
||
| return invoker.start(); |
There was a problem hiding this comment.
Maybe await invoker.start();
smaug----
left a comment
There was a problem hiding this comment.
r+ for the actual benchmark-runner. (I'm less familiar with test tests/* code).
Perhaps assign the callbacks to variables and pass those as params, that might improve the readability a bit.
142589c to
74bbaf6
Compare
This PR adds a new query string parameter requestAnimationFrame, which takes the value of either "timer" or "raf". "timer" is the existing and default measurement method. When it's "raf", we use two consecutive requestAnimationFrame first of which runs the sync step and second of which schedules a 0s timer to signify the end of async step.
74bbaf6 to
d2750a4
Compare
This PR adds a new query string parameter requestAnimationFrame, which takes the value of either "timer" or "raf". "timer" is the existing and default measurement method. When it's "raf", we use two consecutive requestAnimationFrame first of which runs the sync step and second of which schedules a 0s timer to signify the end of async step.