Generated by npm run bench on 2026-10-20. Every number on this page is read from the CSV files in bench/results, which the benchmark scripts write; none is typed by hand. Run npm run bench to measure again on your machine.
Machine: Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) CPU, 12 logical cores, Node v25.8.1, win32 10.0.26200. Everything runs on one thread.
Random connected graphs with average degree 4 (a random spanning tree plus random extra links, so E = 2V, costs uniform in [1, 10)), one seeded graph per size. Each version computes shortest paths from one router; both are run once untimed first (to let the JIT compile them, and to check they give the same distances), then 5 timed runs each, alternating. The table shows the median of the 5 runs.
| V | links | heap (ms) | naive (ms) | heap is faster by |
|---|---|---|---|---|
| 100 | 200 | 0.224 | 0.479 | 2.1× |
| 500 | 1,000 | 0.655 | 1.136 | 1.7× |
| 1,000 | 2,000 | 0.746 | 3.088 | 4.1× |
| 5,000 | 10,000 | 7.341 | 94.248 | 12.8× |
| 10,000 | 20,000 | 14.595 | 404.722 | 27.7× |
| 20,000 | 40,000 | 39.179 | 1,413.154 | 36.1× |
On a log-log chart a running time of c·V^k is a straight line of slope k. Between the two largest sizes (V = 10,000 and 20,000) the naive version's slope is 1.80 (O(V²) predicts 2) and the heap version's is 1.42 (O((V + E) log V) predicts 1.10). Over the whole range from V = 100 both slopes are lower (1.51 and 0.97): on small graphs the fixed costs (allocating arrays and maps, walking the adjacency lists) take most of the time, not the part that grows fastest.
At V = 20,000 the heap version is 36× faster, far less than the V / log V ≈ 1,400× the step counts alone suggest. The naive inner loop is a tight scan of a plain array, about 3.5 ns per node; the heap version spends about 45.7 ns per (V + E) log V step on Map lookups, allocating heap entries and pushing up to E of them (lazy deletion), so its constant factor is 13× larger.
A 10x10 grid (preset links: 10 Mbps, 2 ms) with 40,000 packets per second network-wide, link-state routing, queues of 32 packets, stats sampled every 250 ms, run for 60 simulated seconds. An event is anything the engine takes off its queue: a packet arriving, a transmission finishing, a new packet from the traffic generator, a stats sample. Each run uses a fresh simulator with the same seed, so all runs do the same work.
| run | events | wall time (s) | events / s | sim s per real s | packets | dropped |
|---|---|---|---|---|---|---|
| 1 | 32,140,754 | 34.62 | 928,270 | 1.73× | 2,398,568 | 7.86% |
| 2 | 32,140,754 | 34.51 | 931,389 | 1.74× | 2,398,568 | 7.86% |
| 3 | 32,140,754 | 34.07 | 943,277 | 1.76× | 2,398,568 | 7.86% |
Median: 931,389 events per second, 13.4 events per packet. 7.86% of the packets were dropped (188,420 because a queue was full), so the busiest links were saturated: the load is heavy.
For each network, 10 links that are not bridges are chosen at random (fixed seed), so every cut leaves the network connected. Each link is cut once, in a fresh simulation under each routing setup, with the same seed and so the same traffic (1,000 packets per second). Links are preset links (10 Mbps, 2 ms; the mesh's delays grow with distance). The network runs 5 s before the cut and is watched for 30 s after it. Failures are noticed after 100 ms; distance-vector advertises every 1000 ms (and at once when routes change), with infinity at 16 and no poison reverse. Per-failure numbers are in convergence-failures.csv.
- Convergence: from the cut to the last forwarding-table change it caused.
- Settled: from the cut until the protocol was quiet: no link-state advertisement in flight, or (distance-vector) one full update period with no change.
- Packets lost and routing messages: counted from the cut until settled.
- Missing routes: router pairs that are still connected at the end but have no route (distance-vector's infinity is 16 hops).
| network | setup | convergence (ms) | settled (ms) | packets lost | routing messages | missing routes |
|---|---|---|---|---|---|---|
| ring(20) | link-state | 117.8 | 138 | 0.8 | 38 | 0 |
| ring(20) | DV + split horizon | 127.6 | 1,129.6 | 90.2 | 185.9 | 20 |
| ring(20) | DV, no split horizon | 128 | 1,130 | 68.6 | 225 | 20 |
| grid(6x6) | link-state | 112 | 117.8 | 0.2 | 166 | 0 |
| grid(6x6) | DV + split horizon | 107.8 | 1,109.8 | 2.1 | 167.1 | 0 |
| grid(6x6) | DV, no split horizon | 107 | 1,109 | 0 | 163.3 | 0 |
| mesh(40) | link-state | 115.6 | 145.5 | 0.1 | 362 | 0 |
| mesh(40) | DV + split horizon | 116.7 | 1,137.2 | 0.6 | 355.4 | 0 |
| mesh(40) | DV, no split horizon | 116.4 | 1,136.9 | 0 | 367.3 | 0 |
Averages over the 10 failures.
- ring(20): fastest to converge is link-state (117.8 ms). Distance-vector with split horizon sends 4.9× the routing messages of link-state while converging. DV + split horizon ends with 20 router pairs on average that are connected but have no route: after the cut some routers are 16 or more hops apart, and distance-vector counts 16 as infinity. DV, no split horizon ends with 20 router pairs on average that are connected but have no route: after the cut some routers are 16 or more hops apart, and distance-vector counts 16 as infinity.
- grid(6x6): fastest to converge is DV, no split horizon (107 ms). Distance-vector with split horizon sends 1× the routing messages of link-state while converging.
- mesh(40): fastest to converge is link-state (115.6 ms). Distance-vector with split horizon sends 1× the routing messages of link-state while converging.