Giter VIP home page Giter VIP logo

Comments (1)

JacksonGL avatar JacksonGL commented on September 28, 2024

However memlab seems to return much smaller heap sized compared to performance.memory.

performance.memory queries the current heap size without running the garbage collector (GC); so it's very fast, but the memory number is bloated. The heap size number in MemLab should be more accurate since MemLab enforces the GC before querying performance.memory and then reports the number to the console. The heap snapshot taken also contains heap size info, which should be more accurate than the number queried from performance.memory.

Does memlab give a precise measurement of the actual portion of the heap that is used by the app?

One thing worth noting is that the performance.memory API and the heap size number from heap snapshots are all trying to measure the JavaScript heap size. There is a non-trivial part of the browser memory not reported by any of those Chrome APIs (e.g., rendering process's memory usage, some parts of the DOM memory, and some native components' memory consumption).

Therefore, the heap size reported by MemLab is more accurate than the performance.memory API you query from web console manually (if you don't run GC). The number is precise in terms of JS heap size, but there is other "invisible" memory not reported.

If I regularly(say with every merged pr) collect statistics of heap size utilizing memlab, would it be accurate enough to evaluate optimization efforts based on that? (if not, what would be the way to do that?)

There are lots of sources of noise that could affect the heap size number. For example, GC in JS engine, JIT, and the non-determinism in the web app itself. So even if you measure the same app twice without any optimization, you may get different heap sizes due to the noise.

The best way to evaluate optimization efforts is to A/B test in production and see if there are stat-sig improvements.

If you have to measure the memory change locally, the improvement has to be bigger than the noises to confirm. I would recommend a very big sample size on both control group and treatment group to make the stat-sig test meaningful. Also keep in mind that your local test account may not be representative and the memory consumption may be biased towards your local app's config, browser version, network, i18n etc.

from memlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.