Skip to content

Instantly share code, notes, and snippets.

@jart
jart / blc.S
Last active June 10, 2023 06:58
Binary Lambda Calculus Virtual Machine for x64 Linux in 400 bytes
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2022 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for │
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
@Glavo
Glavo / PanamaJIT.java
Last active November 23, 2021 10:43
PanamaJIT Demo
import jdk.incubator.foreign.*;
import java.lang.invoke.*;
// Original code (C++): https://stackoverflow.com/a/40937610/7659948
public class PanamaJIT {
public static final int MEM_COMMIT = 0x00001000;
public static final int PAGE_READWRITE = 0x04;
public static final int PAGE_EXECUTE_READ = 0x20;
@jboner
jboner / latency.txt
Last active December 14, 2025 16:19
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD