Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskrycho/fe020b33b567c838fbc404d97f57eb37 to your computer and use it in GitHub Desktop.
Save chriskrycho/fe020b33b567c838fbc404d97f57eb37 to your computer and use it in GitHub Desktop.
Memory Allocation Profiling for Ember + TS Builds

Memory Allocation Profiling for Ember + TS Builds

To get the info we need, you'll be building the app two different ways: the normal way you would with ember-cli-typescript installed, and then with it removed, doing a transpile-only (no type checking) build with Babel.

For the Babel-only build:

  • Remove ember-cli-typescript from your package.json and reinstall your dependencies.
  • Update your ember-cli-build.js following the instructions here.

Then run this test procedure for each of those:

  1. Clear your cache:

    rm -rf $TMPDIR/$USER/if-you-need-to-delete-this-open-an-issue-async-disk-cache

    This is important because it guarantees you're getting a "clean" (or "cold") build with no caching.

  2. Launch the build for debugging:

    node --inspect-brk node_modules/.bin/ember build
  3. Get up the memory profile:

    1. Launch a Chromium browser. (You can do it in FF but I don't actually know the flow!)
    2. Open dev tools.
    3. Click the little Node icon in the top left.
    4. Go to the Memory tab, select Allocation sampling, and click the Start button below the list of JavaScript VM instances.
    5. Go to the Sources tab and click the play button to resume script execution.
    6. Let the build run to completion. Once it reports the build is complete, go back to the Memory tab and click Stop. Wait for the profile to transition from "Stopping..." to showing the profile. Click Save.
  4. Get a snapshot of your app's size: run tokei against your app so we can see how it scales with apps of different sizes. (Please use tokei and not cloc or other tools so the data is consistent as people send this data back!)

That's it—just send me the memory profiles (ping me on Discord or email me) and I can dig into the analysis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment