Port output benchmark
Build with v -cc gcc -prod -o /tmp/vile-port-output bench/port_output.
Run /tmp/vile-port-output --count 100000 --size 64 --samples 15.
A compiled Scheme loop invokes display on a prepared string/Unicode character,
or write-char, through a host Writer that counts accepted bytes and calls.
One unmeasured warm-up precedes the measured samples; results are medians.
Every answer, byte count, and Writer call count is verified after timing.
VM dispatch, procedure application and GC during execution are included.
No terminal/filesystem I/O or source compilation is timed.
An alternating three-round comparison with nine measured samples per round reported these medians of the round medians:
| 100k operations | Initial port path ms | Current path ms |
|---|---|---|
| Display 64-byte string | 34.714 | 16.360 |
| Display Unicode character | 36.000 | 16.158 |
| Write Unicode character | 25.817 | 16.342 |
The current path borrows a string's stable byte allocation and encodes characters in four stack bytes. Generated C shows no temporary interface boxing for nonblocking reads. The comparison also includes improvements to VM dispatch; it does not isolate formatting/allocation cost from interpreter execution. Tests cover string replacement and GC inside a reentrant Writer with short writes, validating that the borrowed snapshot stays live through the whole call.