Adam Viaud — iOS/macOS engineer SWIFT · 2026
← All labs

LAB 001 · SWIFT FOUNDATION

Find the bytes.

The exact public Foundation API from the merged Swift implementation supplies the result. A companion Boyer–Moore implementation in the same Swift/Wasm module explains every jump.

Page search: a search field repeatedly looks for a small pattern inside a much larger buffer. This is the same shape of problem—without claiming Safari uses this exact API.

Data+Search.swift Swift/Wasm waits until you open this exhibit
AUTHORITATIVE RESULT · SWIFT/WASM Load the real Foundation runtime local release module · loaded on demand
Data UTF-8 bytes
Ready Press “Next comparison” to start.
0 bytes inspected 0 positions skipped naïve comparisons
CURRENT KERNEL SHIFT Waiting for Swift
ALIGNMENT TIMELINE
Load Swift/Wasm to generate the trace.
FOUNDATION TABLES Bad-character shifts
Generated by Swift for the current needle.
Good-substring shifts
Suffix lengths

Foundation supplies the displayed range. The trace and tables come from the same Boyer–Moore kernel merged in swift-foundation commit 55a4bb5, with snapshots added around its real table writes, comparisons, and cursor shifts. JavaScript only maps that data onto this interface.