Comments (1)
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)
- Question: Any idea about ignoring weak reference and circular reference in heap snapshot? HOT 7
- takeHeapSnapshot timed out HOT 10
- core_1.browserInfo.setPuppeteerConfig is not a function HOT 2
- Is there a way to run in scripting mode using silent? HOT 6
- Could not find Chrome (ver. 121.0.6167.85). This can occur if either 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or 2. your cache path is incorrectly configured HOT 5
- Could not find Chrome (ver. 121.0.6167.85). This can occur if either 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or 2. your cache path is incorrectly configured
- Keep `@memlab/*` versions in lockstep in package.json HOT 1
- how to handle Page crashed error ,when execute the run method。 HOT 1
- how to get leak info from memlab console HOT 6
- Clarify the documentation about measure mode HOT 3
- Using a basic `retainerReferenceFilter` causes Node OOM exception HOT 7
- How can I use script_id in IHeapLocation to get js url ? HOT 2
- Runtime exit code 1 during testInBrowser when running in AWS Lambda
- RangeError: Invalid string length in LeakTraceDetailsLogger HOT 3
- memlab find-leaks OOM HOT 6
- Memory Leak Issue in Grid Sample - No Leaks Found by MemLab HOT 1
- Add support for error logging only HOT 12
- "Heap out of memory" when using analyze plugins HOT 7
- devices is undefined when running memlabConfig.setDevice HOT 1
- JSON output HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memlab.