How we improved image download sizes on Medium with just four characters
Adding "auto" to the sizes attribute of lazy-loaded images lets the browser pick the best srcset candidate from the actual layout, with no hand-written breakpoint rules. Medium saw roughly 7% smaller image downloads on its home feed on some displays. The explanation covers why <picture>, srcset and sizes exist: browsers fetch images before layout, so sizes must otherwise be hand-calculated. Unsupported browsers ignore the unparseable "auto" token, so the change is backwards compatible, and WordPress has already adopted it.
Related posts
- Squarespace & Web Standards: How We Helped Bring HTML Video & Audio Lazy Loading to Today’s Browsers
Squarespace Engineering easyNoviceSquarespace engineers proposed and landed loading="lazy" for HTML <video> and <audio> in the WHATWG HTML Standard (merged March 23, 2026). The attribute defers fetching media resources, poster images and autoplay until the element is visible, removing the need for JavaScript workarounds for the web's heaviest asset type. The team also contributed more than 30 Web Platform Tests and wrote patches for Firefox and WebKit, while a Chromium implementation shipped in Chrome 147 behind a flag and is enabled by default in Chrome 148. The process ran from a hackathon prototype through an HTML issue, a spec PR, vendor standards positions and browser code review, and shows that full-stack web developers can contribute directly to the platform.
- How To Use Standard HTML Video & Audio Lazy-Loading on the Web Today
Squarespace Engineering mediumAdeptHTML <video> and <audio> elements now accept the same loading="lazy" attribute as images and iframes, deferring media, poster images and even autoplay until the element is visible near the viewport. Practical guidance covers setting width/height or aspect-ratio to avoid layout shift, pairing preload="none" with poster, keeping muted and playsinline for autoplay, and including controls on audio so it is visible enough to trigger loading. Avoid lazy loading above-the-fold media because it delays fetches until after layout and can hurt Largest Contentful Paint. Support can be detected with 'loading' in HTMLMediaElement.prototype; Chrome 148 ships it by default, and Squarespace-contributed Firefox and WebKit implementations are in review.
- Bun v1.3.14
Bun mediumAdept
Bun v1.3.14 adds Bun.Image, a built-in, sharp-compatible image pipeline that benchmarks 1.2–1.4× faster than sharp on resize/encode thanks to fixed-point SIMD resize kernels and JPEG IDCT downscaling. It also adds an experimental global virtual store for isolated installs that replaces per-file clonefileat calls with per-package symlinks, cutting a warm 1,400-package install from 841 ms to 115 ms on macOS. Other additions include experimental HTTP/3 (via lsquic) in Bun.serve, experimental HTTP/2 and HTTP/3 clients for fetch() with RFC 9113 hardening against CONTINUATION floods and PING reflection, a rewritten fs.watch() on inotify/FSEvents/kqueue, and a --no-orphans mode built on PR_SET_PDEATHSIG and kqueue NOTE_EXIT.
- Build a Simple Image Resizing API in less than 100 LOC
Deno mediumAdeptAn HTTP image resizing API built on Deno uses imagemagick_deno, ImageMagick compiled to WebAssembly, and fits in under 100 lines of TypeScript. The server validates query parameters (image URL, width and height capped at 2048, and a resize or crop mode), fetches the remote image and checks its Content-Type. It then resizes or crops it with MagickGeometry, ignoring aspect ratio only when both dimensions are given. The finished single-file app deploys to Deno Deploy via GitHub integration.
- Bun v1.1.21
Bun mediumAdept
Bun v1.1.21 fixes 72 bugs and speeds up gzip/deflate decompression in fetch() by 30% on Linux x64 by switching to libdeflate, which also speeds up the WebSocket server. A new --fetch-preconnect flag and fetch.preconnect() API open the DNS/TCP/TLS connection before user code runs, cutting a first request from about 52ms to 8ms in the shown example. Linker, compiler and LTO changes shrink the Linux binary by 4 MB to 92 MB and trim 1ms from startup. The bundler adds --packages=external and content-aware code-splitting hashes, alongside many Node.js compatibility and crash fixes.