FileFS: Implement a virtual file system within a single file.
.
├── bench/ # Cross-language full-API benchmark harness + matrix
├── c/ # C implementation (original)
├── cpp/ # Pure C++20 port
├── dotnet/ # Pure C# / .NET port
├── go/ # Pure-Go port
├── java/ # Pure Java 21 port
├── kotlin/ # Pure Kotlin/JVM port
├── lua/ # Pure Lua 5.4 port
├── moonbit/ # Pure MoonBit port
├── nodejs/ # Pure JavaScript ESM port
├── python/ # Python package (CPython bindings to c/)
├── rust/ # Pure-Rust port
├── swift/ # Pure Swift port
├── wasm/ # WebAssembly (Zig) + JS glue (in-memory image)
├── zig/ # Pure-Zig port
├── LICENSE
└── README.md
cd c
make
./demoIncludes FileGit (git-like VCS at /.git) and FileXfer (host ↔ FileFS
binary import/export, including directory trees). See c/README.md.
cd c && make testSee c/README.md.
cmake -S cpp -B cpp/build -DCMAKE_BUILD_TYPE=Release
cmake --build cpp/build -j
ctest --test-dir cpp/build --output-on-failureSee cpp/README.md.
cd dotnet
dotnet testSee dotnet/README.md.
cd go
go build -o demo ./cmd/demo
./demoSee go/README.md.
mvn -f java/pom.xml testSee java/README.md.
cd kotlin
./build.shSee kotlin/README.md.
cd lua
lua5.4 tests/run_tests.luaSee lua/README.md.
cd moonbit
moon testSee moonbit/README.md.
cd nodejs
npm testSee nodejs/README.md.
cd python
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
python -m unittest discover -s tests -vSee python/README.md.
cd rust
cargo testSee rust/README.md.
cd swift
swift testSee swift/README.md.
cd wasm
zig build
npm testIn-memory FileFS image for browser/Node via Zig wasm32-freestanding + JS glue.
See wasm/README.md.
cd zig
zig build testSee zig/README.md.
Host language ports share the same on-disk format (512-byte blocks, magic 78 11 45 14).
The Wasm port uses the same block layout in an in-memory image suitable for browsers.
Cross-language full-API microbenchmarks (ns/op, lower is better).
Workload: filefs-full-api · iterations=20 · payload=4096 bytes.
Cell colors are row-relative (green = faster for that API among measured ports, red = slower).
| API \ Lang | c | cpp | dotnet | go | java | kotlin | lua | moonbit | nodejs | python | rust | swift | wasm | zig |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mkfs | 193.6µs |
191.3µs |
256.0µs |
191.1µs |
550.7µs |
580.1µs |
97.5µs |
61.5µs |
216.2µs |
442.0µs |
204.2µs |
214.1µs |
1.5µs |
194.2µs |
| mount+umount | 3.0µs |
3.2µs |
7.7µs |
5.0µs |
34.4µs |
53.4µs |
93.0µs |
31.5µs |
12.1µs |
5.7µs |
3.0µs |
15.7µs |
735ns |
4.4µs |
| mkdir | 333.9µs |
885.3µs |
657.0µs |
399.9µs |
790.6µs |
608.4µs |
50.33ms |
1.49ms |
615.7µs |
797.0µs |
421.0µs |
302.7µs |
3.4µs |
410.9µs |
| chdir+getcwd | 1.1µs |
1.0µs |
2.6µs |
1.9µs |
11.0µs |
7.0µs |
2.0µs |
4.4µs |
25.5µs |
1.4µs |
1.1µs |
4.3µs |
4.0µs |
4.7µs |
| open(w)+close | 258.7µs |
349.8µs |
544.2µs |
334.1µs |
687.8µs |
591.0µs |
92.61ms |
1.29ms |
572.4µs |
245.8µs |
329.6µs |
236.4µs |
3.5µs |
323.6µs |
| write 4KiB | 606.4µs |
787.8µs |
1.14ms |
856.8µs |
1.40ms |
1.44ms |
326.56ms |
7.33ms |
1.50ms |
549.4µs |
826.7µs |
524.1µs |
4.0µs |
1.12ms |
| read 4KiB | 3.2µs |
3.3µs |
4.2µs |
10.1µs |
17.6µs |
6.1µs |
80.0µs |
12.0µs |
29.0µs |
3.7µs |
6.8µs |
15.6µs |
3.2µs |
10.7µs |
| seek+tell+rewind | 2.9µs |
3.0µs |
7.0µs |
9.2µs |
16.3µs |
5.4µs |
2.0µs |
2.9µs |
49.4µs |
3.4µs |
14.6µs |
29.6µs |
3.4µs |
6.3µs |
| copy_file | 578.3µs |
1.00ms |
1.42ms |
965.9µs |
1.26ms |
1.23ms |
376.95ms |
7.66ms |
2.26ms |
557.5µs |
926.7µs |
723.5µs |
8.1µs |
736.3µs |
| rename | 25.5µs |
1.24ms |
1.38ms |
1.05ms |
1.84ms |
1.91ms |
603.29ms |
5.11ms |
1.90ms |
714.6µs |
1.68ms |
871.0µs |
11.4µs |
965.9µs |
| remove_file | 258.4µs |
844.4µs |
843.2µs |
896.5µs |
1.14ms |
1.18ms |
403.27ms |
3.40ms |
1.33ms |
499.2µs |
1.33ms |
597.7µs |
6.8µs |
637.1µs |
| opendir+readdir | 1.9µs |
1.7µs |
4.5µs |
3.3µs |
11.5µs |
14.5µs |
13.0µs |
20.2µs |
26.1µs |
15.4µs |
3.6µs |
7.1µs |
22.3µs |
3.8µs |
| file/dir exists | 2.6µs |
2.6µs |
3.2µs |
5.1µs |
10.0µs |
1.6µs |
2.0µs |
1.9µs |
19.9µs |
4.2µs |
2.7µs |
10.8µs |
23.5µs |
3.0µs |
| begin+write+commit | 244.2µs |
420.7µs |
574.8µs |
547.4µs |
632.3µs |
817.1µs |
329.10ms |
3.10ms |
811.8µs |
408.6µs |
449.6µs |
382.4µs |
6.4µs |
357.2µs |
Source SVG
Regenerate:
python3 bench/run_all.pyRaw results: bench/results/latest.json · unix=1784876936.
Harness details: bench/README.md.
