Skip to content

Instantly share code, notes, and snippets.

@jrmuizel
Created April 30, 2025 15:13
Show Gist options
  • Save jrmuizel/bc82c393d6712e2ac84849487426f066 to your computer and use it in GitHub Desktop.
Save jrmuizel/bc82c393d6712e2ac84849487426f066 to your computer and use it in GitHub Desktop.
import subprocess
import os
tests_with_workers = ["Air", "Basic", "ML", "Babylon", "cdjs",
"first-inspector-code-load", "multi-inspector-code-load",
"Box2D", "octane-code-load", "crypto", "delta-blue",
"earley-boyer", "gbemu", "mandreel", "navier-stokes",
"pdfjs", "raytrace", "regexp", "richards", "splay",
"typescript", "octane-zlib", "FlightPlanner", "OfflineAssembler",
"UniPoker", "async-fs", "float-mm.c", "hash-map",
"ai-astar", "gaussian-blur", "stanford-crypto-aes",
"stanford-crypto-pbkdf2", "stanford-crypto-sha256",
"json-stringify-inspector", "json-parse-inspector",
"HashSet-wasm", "tsf-wasm", "quicksort-wasm", "gcc-loops-wasm",
"richards-wasm", "bomb-workers", "segmentation", "WSL",
"3d-cube-SP", "3d-raytrace-SP",
"base64-SP", "crypto-aes-SP", "crypto-md5-SP",
"crypto-sha1-SP", "date-format-tofte-SP", "date-format-xparb-SP",
"n-body-SP", "regex-dna-SP", "string-unpack-code-SP",
"tagcloud-SP", "acorn-wtb", "babylon-wtb", "chai-wtb",
"coffeescript-wtb", "espree-wtb", "jshint-wtb", "lebab-wtb",
"prepack-wtb", "uglify-js-wtb"]
tests = ["Air", "Basic", "ML", "Babylon", "cdjs",
"first-inspector-code-load", "multi-inspector-code-load",
"Box2D", "octane-code-load", "crypto", "delta-blue",
"earley-boyer", "gbemu", "mandreel", "navier-stokes",
"pdfjs", "raytrace", "regexp", "richards", "splay",
"typescript", "octane-zlib", "FlightPlanner", "OfflineAssembler",
"UniPoker", "async-fs", "float-mm.c", "hash-map",
"ai-astar", "gaussian-blur", "stanford-crypto-aes",
"stanford-crypto-pbkdf2", "stanford-crypto-sha256",
"json-stringify-inspector", "json-parse-inspector",
"HashSet-wasm", "tsf-wasm", "quicksort-wasm", "gcc-loops-wasm",
"richards-wasm",
"WSL",
"3d-cube-SP", "3d-raytrace-SP",
"base64-SP", "crypto-aes-SP", "crypto-md5-SP",
"crypto-sha1-SP", "date-format-tofte-SP", "date-format-xparb-SP",
"n-body-SP", "regex-dna-SP", "string-unpack-code-SP",
"tagcloud-SP", "acorn-wtb", "babylon-wtb", "chai-wtb",
"coffeescript-wtb", "espree-wtb", "jshint-wtb", "lebab-wtb",
"prepack-wtb", "uglify-js-wtb"]
tf = True
field_types = True
#tests=["prepack-wtb", "babylon-wtb"]
#tests = ["stanford-crypto-pbkdf2", "stanford-crypto-sha256"]
#tests = ["stanford-crypto-pbkdf2"]
tests = ["OfflineAssembler"]
for test in tests:
sm_cmd = ["perf", "record", "-g", "-k", "mono", "-o", "sm.data",
"/home/jrmuizel/src/gecko-dev/obj-js-nojitspew/dist/bin/js",
"--enable-ic-frame-pointers", "--spectre-mitigations=off",
"--only-inline-selfhosted", "--no-async-stacks",
"-e", f"testList=[{test!r}]", "cli.js"]
sm_before_cmd = ["perf", "record", "-g", "-k", "mono", "-o", "sm-before.data",
"/home/jrmuizel/src/sm-before/obj-js-nojitspew/dist/bin/js",
"--enable-ic-frame-pointers", "--spectre-mitigations=off",
"--only-inline-selfhosted", "--no-async-stacks",
"-e", f"testList=[{test!r}]", "cli.js"]
sm_after_cmd = ["perf", "record", "-g", "-k", "mono", "-o", "sm-after.data",
"/home/jrmuizel/src/sm-after/obj-js-nojitspew/dist/bin/js",
"--enable-ic-frame-pointers", "--spectre-mitigations=off",
"--only-inline-selfhosted", "--no-async-stacks",
"-e", f"testList=[{test!r}]", "cli.js"]
v8_cmd = ["perf", "record", "-g", "-k", "1", "-o", "v8.data",
"/home/jrmuizel/src/v8/out/release/d8", "--perf-prof",
"--interpreted-frames-native-stack",
"--no-parallel-scavenge",
"--allow-natives-syntax", "--no-turbo-inlining",
"--no-maglev-inlining", "--no-compact-code-space",
"-e", f"testList=[{test!r}]"]
if not tf:
v8_cmd.append("--no-turbofan")
if not field_types:
v8_cmd.append("--no-track-field-types")
v8_cmd.append("cli.js")
jsc_cmd = ["perf", "record", "-g", "-k", "1", "-o", "jsc.data",
"/home/jrmuizel/src/WebKit/WebKitBuild/Release/bin/jsc", "--logJITCodeForPerf=true", "--maximumInliningDepth=1", "--useTailCalls=false",
"-e", f"testList=[{test!r}]", "cli.js"]
print(test)
#subprocess.run(sm_cmd, env={"PERF_SPEW_DIR": ".", "IONPERF": "src"})
subprocess.run(sm_before_cmd, env={"PERF_SPEW_DIR": ".", "IONPERF": "src"})
subprocess.run(sm_after_cmd, env={"PERF_SPEW_DIR": ".", "IONPERF": "src"})
#subprocess.run(v8_cmd)
#subprocess.run(jsc_cmd)
samply_path = '/home/jrmuizel/src/samply/target/release/samply'
# Start sm load process
#sm_proc = subprocess.Popen([samply_path, 'import', '--fold-recursive-prefix', '--no-open', 'sm.data'],
# stderr=subprocess.PIPE)
#sm_pid = sm_proc.pid
sm_before_proc = subprocess.Popen([samply_path, 'import', '--fold-recursive-prefix', '--no-open', 'sm-before.data', '-o', 'sm-before.json'],
stderr=subprocess.PIPE)
sm_before_pid = sm_before_proc.pid
sm_after_proc = subprocess.Popen([samply_path, 'import', '--fold-recursive-prefix', '--no-open', 'sm-after.data', '-o', 'sm-after.json'],
stderr=subprocess.PIPE)
sm_after_pid = sm_after_proc.pid
# Start v8 load process
#v8_proc = subprocess.Popen([samply_path, 'import', '--fold-recursive-prefix', '--no-open', 'v8.data'],
# stderr=subprocess.PIPE)
#v8_pid = v8_proc.pid
# Start jsc load process
#jsc_proc = subprocess.Popen([samply_path, 'import', '--fold-recursive-prefix', '--no-open', 'jsc.data'],
# stderr=subprocess.PIPE)
#jsc_pid = jsc_proc.pid
# Get output urls
"""
for i in range(3):
print(sm_proc.stderr.readline())
sm_url = sm_proc.stderr.readline().decode().strip()
for i in range(3):
print(v8_proc.stderr.readline())
v8_url = v8_proc.stderr.readline().decode().strip()
for i in range(3):
print(jsc_proc.stderr.readline())
jsc_url = jsc_proc.stderr.readline().decode().strip()
sm_url = sm_url.split(" ")[4]
v8_url = v8_url.split(" ")[4]
jsc_url = jsc_url.split(" ")[4]
print(sm_url)
print(v8_url)
print(jsc_url)
"""
for i in range(3):
print(sm_before_proc.stderr.readline())
sm_before_url = sm_before_proc.stderr.readline().decode().strip()
for i in range(3):
print(sm_after_proc.stderr.readline())
sm_after_url = sm_after_proc.stderr.readline().decode().strip()
sm_before_url = sm_before_url.split(" ")[4]
sm_after_url = sm_after_url.split(" ")[4]
print(sm_before_url)
print(sm_after_url)
prefix = ""
subprocess.run(['yarn', 'generate-report', 'JetStream' + prefix + '-' + test, '--root-js-func-prefix=runIteration',
'--reference-profile', sm_before_url,
'--alternative-profile', sm_after_url,
'--base-path', '/home/jrmuizel/src/WebKit/PerformanceTests/JetStream2/'], cwd="/home/jrmuizel/src/comparison-report-generator")
"""
prefix = ""
if not tf:
prefix += "NoTF"
if not field_types:
prefix += "NoFieldTypes"
subprocess.run(['yarn', 'generate-report', 'JetStream' + prefix + '-' + test, '--root-js-func-prefix=runIteration',
'--reference-profile', sm_url,
'--alternative-profile', v8_url,
'--alternative2-profile', jsc_url,
'--base-path', '/home/jrmuizel/src/WebKit/PerformanceTests/JetStream2/'], cwd="/home/jrmuizel/src/comparison-report-generator")
"""
# os.kill(sm_pid, 9)
# os.kill(v8_pid, 9)
print("Kill with ctrl-c")
import time
while True:
time.sleep(100000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment