# Observable Slim Benchmarks Generated by `bench/index.js` on **2024-04-13T17:21:38-0700**. Environment: - Node: `v18.15.0` - Platform: `win32 x64` - Runs per case: `10` (with warm-up pass) ## Scaling and Time Complexity Analysis ### Wide object with many leaf children (breadth-heavy) **1. Creation (Graph Setup)** - Input grew **19.8x** (101 → 2,001 nodes). - Time grew **14.0x**. - Verdict: **🚀 Scales Sub-linearly (Excellent)** (Factor: 0.71). **2. Mutation (Property Updates)** - Verdict: **⚡ O(1) Constant Time**. - Write cost is independent of graph size (remains ~1.1 µs). ### Deep linked list (depth-heavy) **1. Creation (Graph Setup)** - Input grew **19.8x** (101 → 2,001 nodes). - Time grew **34.2x**. - Verdict: **⚠️ Scales Poorly** (Factor: 1.73). **2. Mutation (Property Updates)** - Verdict: **📉 O(Depth) Linear Time**. - Write cost grows with depth (lazy path generation). - Shallow: 7.1 µs to Deep: 264.6 µs. ### Balanced k-ary tree (breadth + depth) **1. Creation (Graph Setup)** - Input grew **20.0x** (100 → 2,000 nodes). - Time grew **4.6x**. - Verdict: **🚀 Scales Sub-linearly (Excellent)** (Factor: 0.23). **2. Mutation (Property Updates)** - Verdict: **⚡ O(1) Constant Time**. - Write cost is independent of graph size (remains ~2.9 µs). ## Benchmark Results ### Wide object with many leaf children (breadth-heavy) | Approx. nodes | leaf objects | Total Create (ms) | Cost per Node (ms) | Total Writes | Total Write Time (ms) | Time per Write (µs) | | -------------:| :-------------------- | ----------------:| ----------------:| ------:| ----------------:| ------------------:| | 101 | 100 | 0.24 ±0.22 | 0.00233 | 404 | 1.17 | 2.90 | | 501 | 500 | 0.71 ±0.31 | 0.00142 | 2,004 | 2.34 | 1.17 | | 2,001 | 2,000 | 3.31 ±1.74 | 0.00165 | 8,004 | 8.94 | 1.12 | ### Deep linked list (depth-heavy) | Approx. nodes | depth | Total Create (ms) | Cost per Node (ms) | Total Writes | Total Write Time (ms) | Time per Write (µs) | | -------------:| :-------------------- | ----------------:| ----------------:| ------:| ----------------:| ------------------:| | 101 | 100 | 0.14 ±0.13 | 0.00134 | 404 | 2.87 | 7.10 | | 501 | 500 | 2.04 ±1.59 | 0.00406 | 2,004 | 118.01 | 58.89 | | 2,001 | 2,000 | 4.62 ±1.12 | 0.00231 | 8,004 | 2118.07 | 264.63 | ### Balanced k-ary tree (breadth + depth) | Approx. nodes | target node count (approx) | Total Create (ms) | Cost per Node (ms) | Total Writes | Total Write Time (ms) | Time per Write (µs) | | -------------:| :-------------------- | ----------------:| ----------------:| ------:| ----------------:| ------------------:| | 100 | 100 | 1.72 ±2.26 | 0.01722 | 400 | 1.09 | 2.72 | | 500 | 500 | 1.58 ±0.58 | 0.00317 | 2,000 | 5.33 | 2.66 | | 2,000 | 2,000 | 7.85 ±5.63 | 0.00393 | 8,000 | 22.83 | 2.85 |