radex.io

aboutarchivefediversecode

Jsonnet tutorial

I recorded a 13-minute Jsonnet tutorial.

Jsonnet is an excellent choice for a configuration language, such as for Kubernetes IaC (but also, any other complex config that’s hard to maintain by hand).

Unlike JSON and YAML, you can easily reuse snippets, create complex templates with logic that determines exact contents based on parameters, import arbitrary files, generate json/yaml/ini/python/etc from plain structures, and so much more. Yet, it remains just a description language, avoiding the complexity of using scripting languages to generate config files.

Jsonnet absolutely deserves to be more popular than it is, so I’m hoping my tutorial will inspire at least a few of you to give it a try.

Give it a watch:

Hermes Hacking: Demystifying JavaScript Engines

I gave the “Hermes Hacking” talk on the (excellent) React Native EU conference. It’s an introduction to how JavaScript engines work, for developers that have no background in parsers, compilers, or interpreters. I briefly cover lexing, parsing, AST interpretation, bytecode generation, garbage collection, with some Hermes-specific topics, and links to articles where you can learn more.

Give it a watch:

Read on »

I made JSON.parse() 2x faster

Part of my job is to make JavaScript things go fast. Speed is a feature, and when working in an interpreted language, squeezing every last bit of performance can be the difference between a great product and unusable garbage.

Anyway, how cool would it be to make JavaScript itself go faster? I’m not a C++ programmer, but that didn’t stop me before, so I thought I’d give it a try anyway!

The objective

We’ll make a common operation, JSON.parse(), faster. There are real world use cases where you’d want to parse large JSONs, such as initial login to an offline-first app, or deserializing persisted state at launch. By making it twice as fast, it could have real impact on users, as opposed to optimizing some obscure microbenchmark.

The JavaScript engine we’ll target is Hermes, used primarily by React Native. Improving V8 (Chrome, Node) or JSC (Safari, Bun) would have greater impact, but Hermes is relevant to my work.

Read on »