Skip to content

Instantly share code, notes, and snippets.

@krisselden
Last active July 28, 2021 15:44
Show Gist options
  • Save krisselden/d3ce3cbb37cc6035b0927fdbf4117b3c to your computer and use it in GitHub Desktop.
Save krisselden/d3ce3cbb37cc6035b0927fdbf4117b3c to your computer and use it in GitHub Desktop.
Trace Chrome Deopts

trace-deopt.sh

How to use

./trace-deopt.sh http://localhost:4200

Wait until your page renders.

This will output files that look like code-64178-1.asm and hydrogen-64178-1.cfg for each process. Look for the largest hydrogren cfg one with a create timestamp and its corresponding code asm file.

You can visualize them by opening them in IRHydra 2

#!/usr/bin/env bash
# check for CHROME_BIN env or just default
cmd=${CHROME_BIN:-/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome}
if [ -z "$1" ]
then
echo "Usage: `basename $0` [url]"
exit 1
fi
user_data=`mktemp -d -t profile`
"$cmd" --user-data-dir="$user_data" \
--no-default-browser-check \
--ignore-certificate-errors \
--metrics-recording-only \
--no-sandbox \
--no-experiments \
--disable-component-extensions-with-background-pages \
--disable-background-networking \
--disable-extensions \
--disable-default-apps \
--noerrdialogs \
--no-default-browser-check \
--disable-translate \
--no-first-run \
--js-flags="--trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces" "$1"
rm -rf "$user_data"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment