Closed emmaxtung closed 12 months ago
Here are a few things worth mentioning when it comes to evaluating memory performance and memory leaks across platforms and web apps:
Taking these factors into account, drawing concrete conclusions about memory performance and leaks based solely on the given data can be challenging. It's worth noting that MemLab is primarily designed as a tool for identifying memory leaks and exploring opportunities for memory optimization, rather than as a measurement tool.
A more reliable way to obtain an overview of memory performance is to directly gather data regarding the main thread JavaScript (JS) heap size from the production environment (by using the performance.memory
API) and compute the average memory usage as well as the 99th percentile (p99) of memory usage.
In your specific case, you've noted that platform 2 is not a SPA. This means that the JavaScript heap is destroyed and rebuilt after each navigation. While this process may not be ideal for performance due to the constant overhead, it does have a somewhat protective aspect when it comes to memory leaks. Unlike SPAs, where memory leaks can accumulate over time across page navigations, the potential impact of memory leaks in platform 2 might be relatively less severe, as each page load essentially cleans up the JS heap (including memory leaks from previous navigations).
Thanks for the detailed response, really appreciate it! I previously had some assumptions of the factors you listed above so it's good to have this confirmation.
I'm running tests of just the initial load of two identical pages across two different web platforms and for platform 1, I see ~80mb of memory usage with 8 leaks. On platform 2, I see ~20mb of memory usage with 11 leaks. Given this information and without looking into the trace (assuming code is minified), would you say that it is possible to make a conclusion whether platform 1 or platform 2 has better memory performance, or would I need to dig deeper?
I was expecting platform 2 to have little to no leaks, so I am surprised by the results, but I'm not sure if low memory usage with high leaks is better than high memory usage with low leaks or not. I'm sure it would be easier to tell if I measured page actions, but platform 2 is not a SPA and therefore I am only testing initial load for both. Thanks in advance