Add support for memory measurements
Opened this issue · 0 comments
With the --enable-precise-memory-info
flag enabled in Chrome, we can use window.performance.memory.usedJSHeapSize
to measure the current heap size. I'd like to add the ability to capture this metric. We would also probably want to expose the GC (using the --js-flags=--expose-gc
flag) so we can force a GC before reading the memory to make the reading more consistent.
I can think of a couple different ways to do this:
-
Do nothing
Technically, this could be supported today with the current API by using a global expression.Pros:
- Doesn't add Chrome specific measurements to Tachometer
- User can control how & when to collect measure memory
Cons:
- Requires user to manually pass in
--precise-memory-info
and--expose-gc
flags
-
Read value at end of benchmark
If thememory.usedJSHeapSize
measure is specified, then before closing the tab at the end of the benchmark, force a GC and read its value.Pros:
- Easy for user to configure
Cons:
- User can't control when the measurement is taken
-
Grab value at user-defined time
If thememory.usedJSHeapSize
measure is specified, then after a specified time has elapsed, force a GC and read its value.Pros:
- Easy for user to configure
- User can control when the measurement is taken
Cons:
- May lead to noisy results as we can't guarantee that the measurement will be taken exactly at the time the user specifies (due to the how
setTimeout
work) and what is going on in the benchmark may differ between measurements
I think this already works today but just wanted to mention to be sure, I'd imagine this measurement can be taken along side others so in one run I could collect a performance entry and memory measurement for each benchmark.
Currently thinking 1 or 2 is the most appealing to me.
Thoughts?