react-benchmark icon indicating copy to clipboard operation
react-benchmark copied to clipboard

feat: add --ram option to measure RAM

Open goooseman opened this issue 3 years ago • 7 comments

Adds a special --ram flag and isRamMeasured flag to ReactBenchmark.

If passed RAM measurement is enabled. In this case, 2 metrics are being recorded between the runs:

  • Heap size (JSHeapUsedSize) represents how much RAM was consumed at the end of a test iteration.
  • Object.prototype represents how many objects were created in RAM at the end of a test iteration. Why is it interesting? JS engine sometimes optimizes a code in different ways which in turn changes its memory footprint. source / look at the "Counting all the objects" section

P.S. @Rowno this PR should be merged after #30 to avoid extra conflicts

goooseman avatar Jul 29 '22 09:07 goooseman

@Rowno ready for review

goooseman avatar Aug 03 '22 11:08 goooseman

@Rowno In the end something you was worried about has happened: we do have a flaky test.

And it is flaky on CI only, which makes it completely difficult to debug.

As of now I do have 0 ideas of why is it happening: even though CI is much less powerful than my local machine, but still CPU threshold should make it even 4x times slower, so the tests should always pass.

I will try to research this a little bit.

goooseman avatar Aug 03 '22 15:08 goooseman

@Rowno From this thread I see there is a problem in CPU throttling of Chrome running inside docker.

I believe it is better to remove this failing test: it does not provide as much as quality, as number of problems it creates.

goooseman avatar Aug 04 '22 14:08 goooseman

Yeah, I would remove the test.

Rowno avatar Aug 05 '22 01:08 Rowno

@Rowno ahaha, I've also deleted it in this PR.

Updated PR, ready for review

goooseman avatar Aug 05 '22 09:08 goooseman

@Rowno WDYT about this change?

goooseman avatar Aug 24 '22 08:08 goooseman

@Rowno ping

goooseman avatar Aug 29 '22 07:08 goooseman