matklad.github.io

订阅源链接共 10 篇文章

make.ts

make.ts Jan 27, 2026 Up Enter Up Up Enter Up Up Up Enter Sounds familiar? This is how I historically have been running benchmarks and other experiments requiring a repeated sequence of commands — type them manually once, then rely on shell history (and maybe some terminal splits) for reproduction. These past few years I’ve arrived at a much better workflow pattern — make.ts . I was forced to adapt it once I started working with multiprocess applications, where manually entering commands is borde...

2026-01-27 00:00原文链接
未翻译

Considering Strictly Monotonic Time

Considering Strictly Monotonic Time Jan 23, 2026 Monotonic time is a frequently used, load bearing abstraction. Monotonicity is often enforced using the following code: fn now (clock: * Clock) Instant { const t_raw = os_time_monotonic(); const t = @max (t_raw, clock.guard); assert(t >= clock.guard); assert(t >= t_raw); clock.guard = t; return t; } That is, ask the OS about the current monotonic time, but don’t trust the result too much and clamp it using an in-process guard. Under normal s...

2026-01-23 00:00原文链接
未翻译

Vibecoding #2

Vibecoding #2 Jan 20, 2026 I feel like I got substantial value out of Claude today, and want to document it. I am at the tail end of AI adoption, so I don’t expect to say anything particularly useful or novel. However, I am constantly complaining about the lack of boring AI posts, so it’s only proper if I write one. Problem Statement At TigerBeetle, we are big on deterministic simulation testing . We even use it to track performance , to some degree. Still, it is crucial to verify performance nu...

2026-01-20 00:00原文链接
未翻译

Memory Safety Is ...

Memory Safety Is … Dec 30, 2025 Memory safety is one of those elusive concepts like intelligence, consciousness, or porn , that resist attempts to be put to words. Thus, I am not going to attempt to define it. Instead, I want to poke holes in definitions of others. Note that the present post is 90% sophistry in the style of Zeno — I don’t think you need a water-tight definition to have a reasonable discussion, and no definition can save an unreasonable one. But thinking about definitions focuses...

2025-12-30 00:00原文链接
未翻译

The Second Great Error Model Convergence

The Second Great Error Model Convergence Dec 29, 2025 I feel like this has been said before, more than once, but I want to take a moment to note that most modern languages converged to the error management approach described in Joe Duffy’s The Error Model , which is a generational shift from the previous consensus on exception handling. C++, JavaScript, Python, Java, C# all have roughly equivalent throw , catch , finally constructs with roughly similar runtime semantics and typing rules. Even fu...

2025-12-29 00:00原文链接
未翻译

Parsing Advances

Parsing Advances Dec 28, 2025 I find myself writing yet another toy parser, as one does during a Christmas break. It roughly follows Resilient LL Parsing Tutorial . Not because I need resilience, but mostly because I find producing a syntax tree and a collection of diagnostics a more natural fit for the problem than bailing out on the first error. One practical pitfall with the approach is infinite loops/recursion. Resilience sometimes means not consuming a token, and, if you do that in a loop o...

2025-12-28 00:00原文链接
未翻译

Static Allocation For Compilers

Static Allocation For Compilers Dec 23, 2025 TigerBeetle famously uses “static allocation” . Infamously, the use of the term is idiosyncratic: what is meant is not static arrays, as found in embedded development, but rather a weaker “no allocation after startup” form. The amount of memory TigerBeetle process uses is not hard-coded into the Elf binary. It depends on the runtime command line arguments. However, all allocation happens at startup, and there’s no deallocation. The long-lived event lo...

2025-12-23 00:00原文链接
未翻译

Newtype Index Pattern In Zig

Newtype Index Pattern In Zig Dec 23, 2025 In efficiency-minded code, it is idiomatic to use indexes rather than pointers. Indexes have several advantages: First , they save memory. Typically a 32-bit index is enough, a saving of four bytes per pointer on 64-bit architectures. I haven’t seen this measured, but my gut feeling is that this is much more impactful than it might initially seem. On modern architectures, saving memory saves time (and energy) as well, because the computing bottleneck is ...

2025-12-23 00:00原文链接
未翻译

Do Not Optimize Away

Do Not Optimize Away Dec 9, 2025 Compilers are sneaky beasts. If you time code like this: var total: u32 = 0 ; for ( 0 ..N) | i | total += i; print( "total={}" , .{total}); You will discover that LLVM is as smart as a little kid named Gauss, and replaces the summation with an equivalent formula N ( N + 1 ) 2 . What’s more, if you write something more complicated like total += i + 2*i*i - i*i*i , you’ll see that LLVM figures out a closed-form expression for that as well (a generalizatio...

2025-12-09 00:00原文链接
未翻译

Mechanical Habits

Mechanical Habits Dec 6, 2025 My schtick as a software engineer is establishing automated processes — mechanically enforced patterns of behavior. I have collected a Santa Claus bag of specific tricks I’ve learned from different people, and want to share them in turn. Caution: engineering processes can be tricky to apply in a useful way. A process is a logical cut — there’s some goal we actually want, and automation can be a shortcut to achieve it, but automation per se doesn’t explain what the o...

2025-12-06 00:00原文链接
未翻译