LRU cache
Hand-rolled LRU (doubly-linked list + map) servicing 100k mixed get/put operations.
Runtime · median per inner-loop window
Full statistics
| Runner | N | Compile | Runtime | P95 | Stddev | RSS | vs piko | Status |
|---|---|---|---|---|---|---|---|---|
| Native Gocompiled | 10 | 180 ms | 16.2 ms | 16.7 ms | 527 µs | 69 MiB | 0.10× | OK |
| Piko interpbytecode VM | 10 | 1.66 ms | 155 ms | 155 ms | 351 µs | 183 MiB | 1.00× | OK |
| CPython 3.13bytecode VM | 10 | 449 µs | 98.7 ms | 101 ms | 1.92 ms | n/a | 0.64× | OK |
| PyPy 7.3tracing JIT | 10 | 368 µs | 15.0 ms | 16.3 ms | 516 µs | n/a | 0.10× | OK |
| tengobytecode VM | 10 | 313 µs | 174 ms | 177 ms | 5.21 ms | 872 MiB | 1.13× | OK |
| scriggobytecode VM | 0 | n/a | n/a | n/a | n/a | n/a | n/a | unsupported |
| mvmbytecode VM | 10 | 461 µs | 323 ms | 361 ms | 20.8 ms | 63 MiB | 2.09× | OK |
| yaegiAST walker | 10 | 567 µs | 966 ms | 996 ms | 23.9 ms | 66 MiB | 6.25× | OK |
Workload & symmetry rules
Workload
A cache of size 4096 sees a 100,000-op trace of 70% reads / 30% writes. Implement using a hash map plus a doubly-linked list for recency. Print the final hit/miss totals.
Symmetry rules
- Hand-rolled linked list; no
OrderedDict, nofunctools.lru_cache. - Generic map / dict for indexing.
Source code
piko / Go
piko_source.gonative Go
native_main.goCPython / PyPy
cpython.pytengo
script.tengo