Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for memory measurements #181

Open
andrewiggins opened this issue Aug 12, 2020 · 0 comments
Open

Add support for memory measurements #181

andrewiggins opened this issue Aug 12, 2020 · 0 comments
Labels
Needs Discussion Needs Discussion

Comments

@andrewiggins
Copy link
Contributor

andrewiggins commented Aug 12, 2020

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:

  1. 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
  2. Read value at end of benchmark
    If the memory.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
  3. Grab value at user-defined time
    If the memory.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?

@aomarks aomarks moved this to Needs Discussion in Lit Project Board Jan 24, 2022
@sorvell sorvell moved this from 💬 Needs Discussion to 📋 Triaged in Lit Project Board Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Needs Discussion
Projects
None yet
Development

No branches or pull requests

1 participant