1.1.1 • Published 3 years ago

memory-stats-alt v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

memory-stats.js

Like stats.js but for JS memory

@jeromeetienne, inspired by mrdoob's stats.js code, wrote this as part of tquery. I've now promoted it to a standalone repo and cleaned it all up.

image

Usage:

  1. Start Chrome with --enable-precise-memory-info
    • Otherwise the results from performance.memory are bucketed and less useful.
  2. Include memory.stats.js
  3. Instantiate it (stats = new MemoryStats(), add the stats.element to the DOM, and run stats.update() regularly.

That might look something like:

    var stats = new MemoryStats();

    stats.domElement.style.position = 'fixed';
    stats.domElement.style.right        = '0px';
    stats.domElement.style.bottom       = '0px';
    
    document.body.appendChild( stats.domElement );

    requestAnimationFrame(function rAFloop(){
        stats.update();
        requestAnimationFrame(rAFloop);
    });

Run Chrome with the flag and open demo/index.html to see it in action.

Framework adaptors

Bookmarklet

You can add this code to any page using the following bookmarklet:

javascript:(function(){var script=document.createElement('script');script.src='https://rawgit.com/xudafeng/memory-stats.js/master/bookmarklet.js';document.head.appendChild(script);})()
1.1.1

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago