Bun Bytecode Caching
Speed up JavaScript execution with bytecode caching in Bun's bundler
Skill by jarle
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/jarle-bun-bytecode-caching
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/bun-bytecode-caching
What's inside
- Skill name
Bun Bytecode Caching- Description
- Speed up JavaScript execution with bytecode caching in Bun's bundler
- License
- MIT
- Instructions
- 448 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- name: only lowercase letters, digits and single hyphens allowed
- name: "Bun Bytecode Caching" does not match folder "bun-bundler-bytecode"
Files (1)
- SKILL.md
SKILL.md (first lines)
# Bytecode Caching
> Speed up JavaScript execution with bytecode caching in Bun's bundler
Bytecode caching is a build-time optimization that dramatically improves application startup time by pre-compiling your JavaScript to bytecode. For example, when compiling TypeScript's `tsc` with bytecode enabled, startup time improves by **2x**.
## Usage
### Basic usage (CommonJS)
Enable bytecode caching with the `--bytecode` flag. Without `--format`, this defaults to CommonJS:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun build ./index.ts --target=bun --bytecode --outdir=./dist
```
This generates two files:
* `dist/index.js` - Your bundled JavaScript (CommonJS)
* `dist/index.jsc` - The bytecode cache file
At runtime, Bun automatically detects and uses the `.jsc` file:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun ./dist/index.js # Automatically uses index.jsc
```
### With standalone executables
When creating executables with `--compile`, bytecode is embedded into the binary. Both ESM and CommonJS formats are supported:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
# ESM (requires --compile)
bun build ./cli.ts --compile --bytecode --format=esm --outfile=mycli
# CommonJS (works with or without --compile)
bun build ./cli.ts --compile --bytecode --outfile=mycli
```
The resulting executable contains both the code and bytecode, giving you maximum performance in a single file.
### ESM bytecode
ESM bytecode requires `--compile` because Bun embeds module metadata (import/export information) in the compiled binary. This metadata allows the JavaScript engine to skip parsing entirely at runtime.
Without `--compile`, ESM bytecode would still require parsing the source to analyze module dependencies—defeating the purpose of bytecode caching.
### Combining with other optimizations
Bytecode works great with minification and source maps:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun build --compile --bytecode --minify --sourcemap ./cli.ts --outfile=mycli
```
* `--minify` reduces code size before generating bytecode (less code -> less bytecode)
* `--sourcemap` preserves error reporting (errors still point to original source)
* `--bytecode` eliminates parsing overhead
## Performance impact
The performance improvement scales with your codebase size:
| Application size | Typical startup improvement |
| ------------------------- | --------------------------- |
| Small CLI (\< 100 KB) | 1.5-2x faster |
| Medium-large app (> 5 MB) | 2.5x-4x faster |
Larger applications benefit more because they have more code to parse.
## When to use bytecode
### Great for:
#### CLI tools
* Invoked frequently (linters, formatters, git hooks)
* Startup time is the entire user experience
* Users notice the difference between 90ms and 45ms startup
* Example: TypeScript compiler, Prettier, ESLint
#### Build tools and task runners
* Run hundreds or thousands of times during development
* Milliseconds saved per run compound quickly
* Developer experience improvement
* Example: Build scripts, test runners, code generators
#### Standalone executables
* Distributed to users who care about snappy performance
* Single-file distribution is convenient
* File size less important than startup time
* Example: CLIs distributed via npm or as binaries
### Skip it for:
* ❌ **Small scripts**
* ❌ **Code that runs once**
* ❌ **Development builds**
* ❌ **Size-constrained environments**
## Limitations
### Version compatibility
Bytecode is **not portable across Bun versions**. The bytecode format is tied to JavaScriptCore's internal representation, which changes between versions.
When you update Bun, you must regenerate bytecode:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
# After updating Bun
bun build --bytecode ./index.ts --outdir=./dist
```
If bytecode doesn't match the current Bun version, it's automatically ignored and your code falls back to parsing the JavaScript source. Your app still runs - you just lose the performance optimization.
**Best practice**: Generate bytecode as part of your CI/CD build process. Don't commit `.jsc` files to git. Regenerate them whenever you update Bun.From jarle/bun-skills, MIT.
More from jarle/bun-skills
- 0.459score
Bun Standalone HTML
jarle
Bundle a single-page app into a single self-contained .html file with no external dependencies
SkillDFreshness: D★ 9Claude Code +9 - 0.459score
Bun Plugins
jarle
Universal plugin API for extending Bun's runtime and bundler
SkillDFreshness: D★ 9Claude Code +9 - 0.459score
Bun HTML & static sites
jarle
Build static sites, landing pages, and web applications with Bun's bundler
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Convert an ArrayBuffer to a Buffer
jarle
Convert an ArrayBuffer to a Buffer
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Convert an ArrayBuffer to a Uint8Array
jarle
Convert an ArrayBuffer to a Uint8Array
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Macros
jarle
Run JavaScript functions at bundle-time with Bun macros
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun esbuild
jarle
Migration guide from esbuild to Bun's bundler
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Feedback
jarle
Share feedback, bug reports, and feature requests
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Hot reloading
jarle
Hot Module Replacement (HMR) for Bun's development server
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Convert an ArrayBuffer to an array of numbers
jarle
Convert an ArrayBuffer to an array of numbers
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Loaders
jarle
Built-in loaders for the Bun bundler and runtime
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Convert an ArrayBuffer to a Blob
jarle
Convert an ArrayBuffer to a Blob
SkillDFreshness: D★ 9Claude Code +9
Signals
- Stars
- 9
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Feb 21, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/jarle/bun-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from jarle
- 0.559score
service-components
jarle
How to design application services with the Service Component pattern.
SkillBFreshness: B★ 3Claude Code +9 - 0.553score
service-component-testing
jarle
How to write tests for services built with Service Components.
SkillBFreshness: B★ 3Claude Code +9 - 0.459score
Bun Plugins
jarle
Universal plugin API for extending Bun's runtime and bundler
SkillDFreshness: D★ 9Claude Code +9 - 0.459score
Bun HTML & static sites
jarle
Build static sites, landing pages, and web applications with Bun's bundler
SkillDFreshness: D★ 9Claude Code +9 - 0.459score
Bun Standalone HTML
jarle
Bundle a single-page app into a single self-contained .html file with no external dependencies
SkillDFreshness: D★ 9Claude Code +9 - 0.456score
Bun Convert an ArrayBuffer to a Uint8Array
jarle
Convert an ArrayBuffer to a Uint8Array
SkillDFreshness: D★ 9Claude Code +9
Cite this page
Bun Bytecode Caching skill. Agent Mart. https://agentmart.dev/skills/jarle-bun-bytecode-caching (last updated 2026-10-24)