How I Made Sharp 950x Faster (And Why It Matters After Bun Joined Anthropic)

Published: (December 14, 2025 at 05:27 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

The Problem with Sharp

Sharp is a battle‑tested image library used in thousands of production apps, but it has several limitations that become painful in modern serverless and high‑concurrency environments:

  • No native HEIC support out of the box
  • Requires building libvips from source
  • Custom Docker layers needed for AWS Lambda
  • Complex CI/CD pipelines
  • Slow metadata extraction (decodes the entire image)
  • Heavy under concurrent load, not optimized for serverless

These issues caused slow processing, expensive servers, and poor user experience in an image‑heavy application.

Introducing bun-image-turbo

A Rust‑powered image processing library built for Bun and Node.js from day one.

  • 100 % open source, MIT licensed, free forever
  • Install with a single command:
npm install bun-image-turbo
  • No custom builds or compilation required
  • Native HEIC support included

Benchmarks

OperationSharpbun-image-turboImprovement
WebP Metadata3.4 ms0.004 ms950× faster
JPEG Metadata0.1 ms0.003 ms38× faster
PNG Metadata0.08 ms0.002 ms40× faster
50 Concurrent Ops160 ms62 ms2.6× faster
Transform Pipeline19.1 ms12.2 ms1.6× faster
HEIC Support❌ (custom build)✅ Native

Metadata extraction

Sharp decodes the whole image to read dimensions:

10 MB image → decode 10 MB → extract width/height → done (3.4 ms)

bun-image-turbo reads only the header bytes:

10 MB image → read ~100 bytes header → extract width/height → done (0.004 ms)

Downscaling strategy

For large downscales, bun-image-turbo uses progressive halving with the optimal filter at each step:

Scale factorAlgorithm
> 4× downscaleBox (fast, good averaging)
2–4× downscaleBilinear (fast, acceptable quality)
  • GitHub:
  • npm:

What You Get

FeatureBenefit
Metadata extraction950× faster
Concurrent operations2.6× faster
Transform pipelines1.6× faster
HEIC supportNative, no custom builds
BlurhashBuilt‑in
PriceFree forever

Getting Started

npm install bun-image-turbo

For questions, drop a comment in the repository issues. If you find this useful, consider starring the repo ⭐.

Back to Blog

Related posts

Read more »