Flame graphing the leftness of infra tooling
Last month I claimed chant sits to the left of other infra toolchains when it comes to execution.
To prove this claim I wrote the same small app for both CDK and chant and verified both produce the same resources. Then I ran each tool with Node’s profiler recording.
A recording reads from left to right, with time on the X axis. Every block is code that ran, and highlighted blocks are caused by your app, meaning your files, plus the infrastructure library they pull in.
Here are both runs, same recorder, same lighting rule:
The top strip is CDK. The yellow line near the left edge is your program starting, and from there the strip stays lit to the end. Everything CDK knows about your infrastructure it learned by running your program and watching what it constructs. Zoom in and you can read it happening:
Table2 is your database table. Role2 is your IAM role. Function2 is your Lambda. Each one came into existence because a constructor executed inside cdk synth.
This is CDK’s design. There is no way to know what a CDK app builds without running it, which means whatever your program does happens before the tool knows what it’s looking at.
The bottom strip is chant, and it’s just as busy, but nothing lights up. That’s not a lucky sample from a profiler that happened to look away: the build refuses to finish unless it can account for every file without running it.
Don’t take the pictures’ word for it. Both recordings are live in spicypath, my profile viewer. Nothing to install and no login:
- The CDK recording, with a marker on the moment your app starts.
- The chant recording answers the same search with 0 matches because nothing qualifies.
One caveat, this works for files written in chant’s supported style. Files that are deliberately programs still run, in a sandbox, with intention. What sits left of the execution line is exactly the part of your repo that describes infrastructure rather than computes it.
Everything regenerates from committed inputs and the procedure lives in the harness. No timing numbers anywhere in it, on purpose. This is not a benchmark.
Read more
- The far-left IaC tool makes the claim this post records
- TypeScript as data describes the supported style that makes reading-without-running possible
- spicypath is the viewer and it also eats your pprof and JFR and heap dumps