Welcome to nickb.dev, a blog by Nick Babcock! Below are my most recent articles. You can find the history of all my writings in the archive or just find out more about me.


Avoiding allocations in Rust to shrink Wasm modules

“Rust lacks a runtime, enabling small .wasm sizes because there is no extra bloat included like a garbage collector. You only pay (in code size) for the functions you actually use.” Easier said than done, as one has to watch out for allocations as they may significantly impact the Wasm module side.

Read more...


Favoring SQL over Redis for an evergreen leaderboard

Redis is a natural choice for a database when showcasing a leaderboard, but sometimes introducing a database for this purpose can be excessive and unnecessarily complicate an application. Don’t overlook that SQL database you’re already employing.

Read more...


DEFLATE yourself for faster Rust ZIPs

The Rust crate for handling ZIP files, zip-rs is quite flexible. The zip crate is compiled with builtin features to support deflated data (among other compression algorithms). This makes it incredibly easy to hit the ground running for reading and writing zips.

We can disable these builtin features. This may sound undesirable, but in fact, it is my new favorite way to integrate zip functionality into apps I write.d

Read more...


Avoiding dynamic CSS-in-JS styles in React

The React working group have given a lukewarm signal to dynamic CSS-in-JS libraries. They advocate for static CSS extraction with dynamic styling relegated to inline styles. I convert a component from CSS-in-JS to CSS modules and inline styles, and give a positive outlook for adding Tailwind to the mix.

Read more...


The footgun with Docker Compose shared configurations

Docker Compose has a nice feature where several Compose files can be seamlessly fashioned together and allow for configuration reuse across environments. There is, however, counterintuitive behavior that can lead one to accidentally overwrite remote container images. Since I lost several hours to this, I figured I’d write about it to sear the behavior into my memory.

Read more...


The subjective nature of JS libraries exposing an off the main thread API

JavaScript environments like node.js and the browser have a main thread that runs basically everything. Exhausting the main thread can cause bad user experiences. If long-running or computationally intense functions on the main thread are bad, whose responsibility is it to offload the function: the developer of the application or the library? Sometimes the answer isn’t simple.

Read more...


Recommendations when publishing a Wasm library

A set of recommendations to make publishing a Javascript library that uses Wasm internally easier for application developers. There are a significant number of use cases and edge cases that we’ll code around as we try and cater to several types of developers: from those who may not know or care about Wasm and the broader JS ecosystem, to more experienced developers who want to optimize every last drop.

Read more...


Don't freak, but our Rust web server is now Node.js

Even when the core business logic needs to be in Rust for performance, code reuse, or platform specific behavior, it doesn’t mean one needs a Rust web server to communicate this business logic. There are ergonomic ways to bridge Rust into Node.js (or another runtime) so that one can take advantage of a more established web ecosystem.

Read more...


Accessing public and private B2 S3 buckets in Rust

The AWS S3 Storage API is ubiquitous and has been picked up by other 3rd party storage vendors. This is excellent for developers and sysadmins as it facilitates integration testing and experimentation with cloud storage providers. Here’s how to access 3rd party S3 compatible endpoints with the newly released AWS Rust SDK

Read more...


Authoring a SIMD enhanced Wasm library with Rust

All the pieces have come together for widespread Wasm SIMD usage. The majority of browsers and Node 16 LTS support Wasm SIMD out of the box, and Rust recently learned how to compile Wasm intrinsics. Now I need to port a library from x86 SIMD to Wasm SIMD and distribute it in such a way that will fallback to a non-SIMD implementation on unsupported devices.

Read more...