Reputation: 14254
I'm writing a client-heavy site. Since my own testing will only get me so far, I'd like to gather some statistics on how it's performing in the wild.
I'm imagining adding some sort of profiling code to my app which will run some percentage of the time (so it doesn't slow everyone down) and sending that info home.
Adding some timing benchmarks should be easy, but what really becomes a problem with long-running pages with lots of JS is memory usage. Is there a way to instrument the memory used by my app from normal, unprivileged JS code in any of the major browsers? Are there any other good profiling metrics that are available?
Upvotes: 9
Views: 331
Reputation: 7526
In Chrome:
for (var key in performance.memory) {
alert(key+': '+performance.memory[key]);
}
DEMO: http://jsfiddle.net/usuXV/1/
Sample output:
jsHeapSizeLimit: 1620000000
usedJSHeapSize: 10000000
totalJSHeapSize: 16100000
You can also use console.memory
. Seems to return the same results.
Upvotes: 1
Reputation: 1519
It would tricky to measure the memory. The new navigation timing API looks interesting regarding this but at the moment only Chrome has implemented a memory object
Upvotes: 0
Reputation: 103
Take a look at this Google I/O video. It discusses JavaScript memory usage in depth and also how the gmail team observed memory usage for some of their users.
http://www.youtube.com/watch?v=x9Jlu_h_Lyw
Upvotes: 0