jvm-profile
Profile Scala compilation at the JVM level using async-profiler to identify bottlenecks in the compiler, JIT, GC, and macro expansion. Use this skill whenever investigating why compilation is slow at the JVM level, generating flame graphs, analyzing async-profiler output, or understanding where the Scala compiler spends time. Complements the macro-profile skill (macro-level) with JVM-level visibility. Triggers on: "flame graph", "async-profiler", "JVM profile", "compilation bottleneck", "where does the compiler spend time", "JIT warmup", "GC during compilation", "profile the build". --- # JVM Compilation Profiling Profile Scala compilation at the JVM level using async-profiler. This gives visibility into JIT compilation, GC pressure, and Scala compiler internals that the macro-level `macro-profile` skill can't see. ## Prerequisites ```bash brew install async-profiler ``` ## Workflow ### 1. Capture profile data Use `JAVA_TOOL_OPTIONS` (not `JAVA_OPTS`) to profile ALL JVMs including the zinc compilation worker. Use `collapsed` format for the analysis script, and optionally also generate an HTML flame graph for visual inspection. ```bash # Clean compilation cache first rm -rf out/benchmark/sanely # Capture collapsed stacks (for analysis script) JAVA_TOOL_OPTIONS="-agentpath:$(brew --prefix async-profiler)/lib/libasyncProfiler.dylib=start,event=cpu,file=/tmp/profile-collapsed.txt,collapsed" \ ./mill --no-server benchmark.sanely.compile # Capture HTML flame graph (for visual inspection) rm -rf out/benchmark/sanely JAVA_TOOL_OPTIONS="-agentpath:$(brew --prefix async-profiler)/lib/libasyncProfiler.dylib=start,event=cpu,file=/tmp/flamegraph.html" \ ./mill --no-server benchmark.sanely.compile open /tmp/flamegraph.html ```
Changelog: Source: GitHub https://github.com/nguyenyou/circe-sanely-auto
No comments yet. Be the first one!