Evan Wallace

@evan-wallace · account

1 follower

Working on esbuild. Tinkering with peer-to-peer software.

hachyderm.io ↗

I've been studying algorithms for collaborative text editing recently. The best way for me to understand something complex is to implement it myself, so I made my own simple text editing CRDT. It comes with an interactive demo to show what goes on "under the hood":

https://madebyevan.com/algos/crdt-text-buffer/

The code is small enough to understand (only 500 lines including comments). But the internals use optimized block-based storage similar to Yjs (a popular CRDT text library), so it should be pretty realistic.

You can now use modern CSS gradients and esbuild will convert them to legacy gradients for older browsers. This includes non-sRGB colors, interpolation in other color spaces, and alternate hue interpolation modes. The picture below compares Firefox's rendering of the original… Read more

Parcel's latest release brings a huge speedup on esbuild's benchmark (pictured below). It's wonderful to see such significant performance improvements in our web development tools. A 2x end-to-end speedup is no small feat. Congrats to the Parcel team for the achievement!

More information about Parcel's release:

Unlike other JavaScript polyfills for WebAssembly, this one can run real apps. Other JavaScript polyfills crashed with a stack overflow when run on large WebAssembly files, didn't support saturating conversion opcodes, and used very inefficient object-heavy intermediate ASTs. So I'm publishing this polyfill in case others also find it helpful.

I have a working MVP of a new WebAssembly implementation: https://github.com/evanw/polywasm. It implements WebAssembly in JavaScript (i.e. it's a polyfill for WebAssembly), which allows WebAssembly-based apps to still work even when the browser's WebAssembly implementation has been disabled. They will run much slower of course, but some WebAssembly apps don't require real-time performance.

In case you haven't heard about it yet: There's a very exciting effort to add a new flag to TypeScript: https://github.com/microsoft/TypeScript/pull/53463. The flag will be called "--isolatedDeclarations" and will allow external tools such as esbuild to emit ".d.ts" files without needing to implement a type system. This is similar to "--isolatedModules", which allows esbuild to safely convert ".ts" to ".js" without using "tsc".

Request for comments: I’m going to try to fix some long-standing esbuild issues related to tsconfig.json. Biggest change is aligning with tsc’s behavior regarding one tsconfig.json file at a time. My initial proposal is here:

I published a new library called ThumbHash, which generates very compact image representations for image placeholders. There's more info on the website: https://evanw.github.io/thumbhash/

It's inspired by BlurHash but does some things a little differently (e.g. supports alpha, uses binary instead of ASCII, separates luma and chroma).

Big thanks to @WAHa_06x36 for the original BlurHash concept and implementation.

I'm aware that you can work around this by manually moving each sub-expression into its own variable. But no one would want to write code like this. This also seems strange to me as a programmer and compiler author because my intuition is that these two ASTs would be equivalent.

Coding in Swift is so frustrating. I regularly encounter "The compiler is unable to type-check this expression in reasonable time" on trivial graphics code that just does simple things with numbers. Apparently it's because Apple decided to use exponential-time algorithms for Swift's type inference? This seems like such a big design flaw. It's very hard to code when the IDE keeps locking up for many seconds at a time.

More info about Swift's type inference:

The source code for Go 1.20 contains a comment that describes how Go's goroutine stacks are implemented in WASM: https://github.com/golang/go/commit/660d4815ea4229f96cede86f396017ebf5ca4bb0. Go can't use WASM's built-in stack because WASM doesn't give you any control over it (by design). It's cool to finally see a description of what Go's WASM implementation is doing under the hood.

In version 0.17.0, esbuild now has a brand-new incremental build API. You can now enable watch mode and serve mode together, which means live reloading is now built in! This release also fixes some long-standing issues. The documentation has also been overhauled. The new APIs… Read more

The new bundle analyzer for esbuild now has the ability to visualize the CommonJS/ESM breakdown of your bundle: https://esbuild.github.io/analyze/. Click on the CJS vs. ESM bar at the top to toggle it (requires the latest version of esbuild). Using ESM over CommonJS almost always improves performance, so this should be a useful bundle optimization tool.

I also spent way too long making these stripes split and merge while zooming. It was a fun little graphics puzzle.

New favorite life hack: sticking furniture pads on things that lack physical buttons to bring physical buttons back.