Skip to content

Instantly share code, notes, and snippets.

@ober
ober / chez-gc-improvements.diff
Created July 22, 2026 00:40
Chez Scheme GC improvements: unified diff of all ChezScheme/ changes (rendezvous fix, remote batch, adaptive sweep stack, adaptive trip, concurrent mark infrastructure)
diff --git a/ChezScheme/boot/pb/equates.h b/ChezScheme/boot/pb/equates.h
index 286854a..005e06b 100644
--- a/ChezScheme/boot/pb/equates.h
+++ b/ChezScheme/boot/pb/equates.h
@@ -101,8 +101,8 @@ typedef uint64_t U64;
#define bytevector_length_factor 0x8
#define bytevector_length_offset 0x3
#define bytevector_type_disp 0x1
-#define c_entry_name_vector #(thread-context get-thread-context handle-apply-overflood handle-docall-error handle-overflow handle-overflood handle-nonprocedure-symbol thread-list split-and-resize raw-collect-cond raw-collect-thread0-cond raw-tc-mutex raw-terminated-cond activate-thread deactivate-thread unactivate-thread save-errno save-last-error handle-values-error handle-mvlet-error handle-arg-error handle-event-detour foreign-entry install-library-entry get-more-room scan-remembered-set instantiate-code-object Sreturn Scall-one-result Scall-any-results segment-info bignum-mask-test flfloor flceiling flround fltruncate flsin flcos fltan flasin flacos flatan flatan2 flexp fllog fllog2 fl
@ober
ober / gc-performance-wins.md
Created July 22, 2026 00:31
Chez Scheme GC Performance Wins: 40-300x p99 pause reduction via rendezvous fix, remote batch, and adaptive sweep stack

Chez Scheme GC Performance Wins: Stop-the-World Pause Reduction

Executive Summary

Four changes to Chez Scheme's garbage collector reduce multi-threaded GC pause times by 40-300x at p99, bringing total pause from ~27ms worst-case to sub-millisecond on 12-thread workloads. All changes are in the C runtime (vendor/ChezScheme/c/), require no application code changes, and three of four are enabled by default.


Background: How Chez's GC Works

@ober
ober / benchmark.md
Last active February 18, 2026 21:28
Pcre2 vs pregexp vs srfi-115

╔══════════════════════════════════════════════════════════════════════════════╗ ║ Regex Benchmark: gerbil-pcre (PCRE2+JIT) vs pregexp vs SRFI-115 ║ ╚══════════════════════════════════════════════════════════════════════════════╝

pcre2 = gerbil-pcre with PCRE2 + JIT pre = :std/pregexp (pure Scheme) sre = :std/srfi/115 (pure Scheme, SRE syntax)

us/op = microseconds per operation (lower is better)

@ober
ober / gist:69f258935010f961fbb3a98fe273fa05
Created July 2, 2022 11:36
OpenBSD gerbil/gambit builder
#!/bin/sh
set -eu
# OpenBSD builder
# pkg_add automake autoconf gcc-11 gmake
GERBIL_VERSION=v0.17
GAMBIT_VERSION=v4.9.4
-*- mode: compilation; default-directory: "~/gambit/" -*-
Compilation started at Mon Aug 6 20:11:42
cd ~/gambit/ && make -f ~/kunabi/Makefile gambit
system is Darwin
git checkout master && git clean -f && git fetch -a && git reset --hard origin/master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
HEAD is now at 91a4ad2 Update tests/test5.ok test
@ober
ober / gist:b943723f97002ee8e88e92c7ec3b6fe8
Created July 20, 2018 02:51
Gerbil master failure on windows 10.
[*] Building Gerbil
[*] Building gerbil stage0
>>> preparing /cygdrive/c/Users/merc/gerbil/bootstrap
>>> compiling runtime
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../lib/libcygwin.a(libcmain.o): In function `main':
/usr/src/debug/cygwin-2.10.0-1/winsup/cygwin/lib/libcmain.c:37: undefined reference to `WinMain'
/usr/src/debug/cygwin-2.10.0-1/winsup/cygwin/lib/libcmain.c:37:(.text.startup+0x94): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `WinMain'
collect2: error: ld returned 1 exit status
building gerbil/runtime in /cygdrive/c/Users/merc/gerbil/bootstrap/lib
... compile gx-gambc
@ober
ober / gist:9387a64ccffe063376efb7b6c585aa24
Created June 28, 2018 17:06
Docker file for gerbil dev
from gerbil/base:ubuntu
ENV PATH='/root/gerbil/bin:/usr/local/gambit/current/bin:/bin:/usr/bin:/sbin:/usr/sbin'
ENV GERBIL_HOME=/root/gerbil
RUN apt update -y
RUN apt install -y emacs-nox tmux
CMD bash
### Keybase proof
I hereby claim:
* I am ober on github.
* I am lisp (https://keybase.io/lisp) on keybase.
* I have a public key whose fingerprint is CBD7 8720 569B BE32 F060 E3E8 9C95 3681 7159 B703
To claim this, I am signing this object:
@ober
ober / ip
Created July 12, 2016 22:20
netstat in awk
awk -Wposix 'BEGIN{ printf("{ \"tcp_connections\": [") }; {split($2,src,":");split(src[1],sip,"");split($3,dst,":");split(dst[1],dip,"");if ( NR > 1) printf(",");printf("{");printf("\"srcip\":\"%d.%d.%d.%d\",\"sport\": \"%d\",\"dstip\":\"%d.%d.%d.%d\",\"dport\":\"%d\"}","0x" sip[7] sip[8], "0x" sip[5] sip[6],"0x" sip[3] sip[4],"0x" sip[1] sip[2],"0x" src[2],"0x" dip[7] dip[8], "0x" dip[5] dip[6],"0x" dip[3] dip[4], "0x" dip[1] dip[2],"0x" dst[2]);}END{ print "]}"}' < /proc/net/tcp
@ober
ober / anonymous-gist.lisp
Created May 4, 2016 07:22
better format for this?
(defun parse-ct-contents (x)
(let* ((records (cdr (elt (read-json-gzip-file x) 0)))
(record-size (length records)))
(dolist (x records)
(let* ((event-time (cdr-assoc :EVENT-TIME x))
(user-identity (cdr-assoc :USER-IDENTITY x))
(user-name (cdr-assoc :USER-NAME user-identity))
(user-key (cdr-assoc :ACCESS-KEY-ID user-identity))
;;(user-identity (cdr-assoc :ACCESS-KEY-ID (cdr-assoc :USER-IDENTITY x)))