---
title: "Roll your own JavaScript runtime, pt. 3"
description: "V8 startup snapshots can speed up launch of a custom deno_core-based JavaScript runtime at a typically negligible cost in binary size."
url: "https://swe.quest/articles/roll-your-own-javascript-runtime-pt-3-dea9fc6d84e2ecd0"
canonical: "https://deno.com/blog/roll-your-own-javascript-runtime-pt3"
source: "Deno"
published: "2023-05-04"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["runtimes","rust","javascript","performance"]
---

# Roll your own JavaScript runtime, pt. 3

A post on [Deno](https://swe.quest/sources/deno.md), published 2023-05-04, 4 min read, How-to. Original: [https://deno.com/blog/roll-your-own-javascript-runtime-pt3](https://deno.com/blog/roll-your-own-javascript-runtime-pt3)

## Summary

V8 startup snapshots can speed up launch of a custom deno\_core-based JavaScript runtime at a typically negligible cost in binary size. A Cargo build.rs script uses deno\_core's extension! macro and create\_snapshot with CreateSnapshotOptions to serialize the runtime.js extension into RUNJS\_SNAPSHOT.bin in OUT\_DIR. main.rs then embeds the snapshot with include\_bytes!, passes it as startup\_snapshot in RuntimeOptions, and switches the extension to init\_ops() so only the Rust ops are registered at runtime.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- Rust and Cargo build scripts ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- deno\_core JsRuntime basics
- Previous parts of the series

## Keywords

deno\_core, Deno, V8 snapshots, JsRuntime, Cargo build.rs

## Related posts

- [Roll your own JavaScript runtime](https://swe.quest/articles/roll-your-own-javascript-runtime-40ed853bc1965bed.md): Deno · 2022-07-29 · Medium · 8 min read · Runtimes & VMs, Rust, JavaScript
  A minimal JavaScript runtime called runjs can be built in Rust by combining the deno\_core crate, which wraps a V8 isolate in a JsRuntime, with a single-threaded tokio runtime as the event loop.
- [Roll your own JavaScript runtime, pt. 2](https://swe.quest/articles/roll-your-own-javascript-runtime-pt-2-53cebea56dc325e0.md): Deno · 2023-02-15 · Medium · 7 min read · Runtimes & VMs, Rust, JavaScript, TypeScript
  A custom JavaScript runtime built on deno\_core gains three capabilities: a fetch op backed by the reqwest crate and registered in the runjs extension, a CLI that takes the script path as its first argument, and TypeScript/TSX support.
- [Deno's Other Open Source Projects](https://swe.quest/articles/deno-s-other-open-source-projects-d23e8b3569399530.md): Deno · 2025-10-16 · Easy · 7 min read · Open source, Rust, Runtimes & VMs, JavaScript, Developer tools
  Deno publishes many MIT-licensed supporting libraries extracted from its runtime, most of them Rust crates.
- [Deno 1.20 Release Notes](https://swe.quest/articles/deno-1-20-release-notes-bca0b4c539f63df8.md): Deno · 2022-03-17 · Medium · 12 min read · JavaScript, Runtimes & VMs, Performance engineering, Developer tools, Rust
  Deno 1.20 cuts JavaScript-to-Rust op call overhead by up to ~60% by using Rust proc macros to generate a dedicated V8 binding per op, eliminating op routing and skipping deserialization of unused arguments; a 1 MB base64 roundtrip drops from ~125 ms to ~3.3 ms. The release also adds automatic gzip/brotli compression of non-streamed HTTP responses, an unstable \`deno bench\` subcommand (1000 warmup plus 1000 measured iterations by default), and a cross-platform \`deno task\` runner using a POSIX-like shell subset.
- [Wrapping My Mind Around Node.js Runtimes](https://swe.quest/articles/wrapping-my-mind-around-node-js-runtimes-e02012f26cbbaf25.md): Neon · 2024-09-18 · Easy · 8 min read · JavaScript, Runtimes & VMs, TypeScript
  Deno and Bun take different approaches to replacing Node.js as a server-side JavaScript runtime.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
