In a previous post, I set up incremental builds of this site using GNU Make. I was able to reduce the incremental build time (for updating a single post, on my twelve year-old netbook) from 12 seconds (when doing a full rebuild using Deno) to 3 seconds (using Make, and a bunch of smaller scripts, all running under Deno). Unfortunately, the full rebuild time ballooned from 12 seconds to 90 seconds when using Make.
Hello, startup performance!
This is a completely unscientific benchmark, but to get a feel for the minimum amount of startup overhead, I decided to compare the time to run a simple "hello, world" program on:
- Node 18.14.2 (based on V8)
- Deno 1.31.1 (based on V8)
- Leano (based on QuickJS)
Here are the results:
|Runtime||"Hello, world!" elapsed time|
Deno being faster than Node definitely matches my subjective experience. Unfortunately for Bun, I wasn't able to get it to run under Alpine Linux (the official installer seemed to require glibc, and Bun installed via Nix was compiled for a newer instruciton set than what my netbook supports). There appeared to be open issues in Bun's tracker for both problems.
Leano is a minimal (and barely functional) wrapper around QuickJS, so I figured it would be fast for a "hello, world", but I wasn't expecting it to be quite that much faster!
Of course, this is a contrived example, and it's not clear how QuickJS will fare once I throw gigantic transpiled and bundled scripts at it.
Here are the times needed to apply templates to 84 posts on this site under both Deno and Leano (which use the same API):
|Runtime||Templating elapsed time|
These results line up with the previous ones pretty closely: Deno seems to have a startup overhead of 200 - 250 milliseconds, and that adds up when running 80+ processes sequentially. What if I run Make in parallel?
|Runtime||Templating elapsed time (parallel)|
Running two tasks in parallel (on my dual-core machine) closes the gap slightly.
Other simple scripts that took less than a second to run (parsing front matter, generating an index, and creating an Atom feed) showed 30 - 50% improvements.
After moving all the small/trivial scripts over to Leano while leaving Markdown/syntax highlighting to Deno, I was able to improve upon my previous results:
|Full rebuild using "classic" md2blog||12 seconds|
|Full rebuild using "make" solely under Deno||90 seconds|
|Incremental build using "make" soley under Deno||3 seconds|
|Full rebuild using "make" using Deno and Leano||70 seconds|
|Incremental build using "make" using Deno and Leano||1.6 seconds|
In the end, removing Deno's startup penalty from the process resulted in a modest speedup. Unfortunately, it's still slower than running a full rebuild under Deno when in "watch" mode, so, while interesting, this experiment did not lead to any changes in my current workflow.