@adobe/data 0.9.60 → 0.9.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/ecs/archetype/archetype.d.ts +9 -2
  2. package/dist/ecs/archetype/archetype.js.map +1 -1
  3. package/dist/ecs/archetype/create-archetype.js +5 -2
  4. package/dist/ecs/archetype/create-archetype.js.map +1 -1
  5. package/dist/ecs/database/combine-plugins.d.ts +5 -1
  6. package/dist/ecs/database/combine-plugins.js +3 -3
  7. package/dist/ecs/database/combine-plugins.js.map +1 -1
  8. package/dist/ecs/database/concurrency/concurrency-strategy.d.ts +86 -0
  9. package/dist/ecs/database/concurrency/concurrency-strategy.js +3 -0
  10. package/dist/ecs/database/concurrency/concurrency-strategy.js.map +1 -0
  11. package/dist/ecs/database/concurrency/immediate-concurrency.d.ts +22 -0
  12. package/dist/ecs/database/concurrency/immediate-concurrency.js +74 -0
  13. package/dist/ecs/database/concurrency/immediate-concurrency.js.map +1 -0
  14. package/dist/ecs/database/concurrency/index.d.ts +4 -0
  15. package/dist/ecs/database/concurrency/index.js +5 -0
  16. package/dist/ecs/database/concurrency/index.js.map +1 -0
  17. package/dist/ecs/database/concurrency/rebase-replay-concurrency.d.ts +20 -0
  18. package/dist/ecs/database/concurrency/rebase-replay-concurrency.js +34 -0
  19. package/dist/ecs/database/concurrency/rebase-replay-concurrency.js.map +1 -0
  20. package/dist/ecs/database/concurrency/roll-forward-concurrency.d.ts +33 -0
  21. package/dist/ecs/database/concurrency/roll-forward-concurrency.js +115 -0
  22. package/dist/ecs/database/concurrency/roll-forward-concurrency.js.map +1 -0
  23. package/dist/ecs/database/concurrency/roll-forward-concurrency.test.d.ts +1 -0
  24. package/dist/ecs/database/concurrency/roll-forward-concurrency.test.js +136 -0
  25. package/dist/ecs/database/concurrency/roll-forward-concurrency.test.js.map +1 -0
  26. package/dist/ecs/database/create-plugin.d.ts +17 -14
  27. package/dist/ecs/database/create-plugin.js +2 -1
  28. package/dist/ecs/database/create-plugin.js.map +1 -1
  29. package/dist/ecs/database/database.d.ts +61 -11
  30. package/dist/ecs/database/database.index.performance.test.d.ts +1 -0
  31. package/dist/ecs/database/database.index.performance.test.js +417 -0
  32. package/dist/ecs/database/database.index.performance.test.js.map +1 -0
  33. package/dist/ecs/database/database.index.test.d.ts +1 -0
  34. package/dist/ecs/database/database.index.test.js +1142 -0
  35. package/dist/ecs/database/database.index.test.js.map +1 -0
  36. package/dist/ecs/database/database.index.type-test.d.ts +1 -0
  37. package/dist/ecs/database/database.index.type-test.js +275 -0
  38. package/dist/ecs/database/database.index.type-test.js.map +1 -0
  39. package/dist/ecs/database/database.js.map +1 -1
  40. package/dist/ecs/database/database.reset.test.js +2 -1
  41. package/dist/ecs/database/database.reset.test.js.map +1 -1
  42. package/dist/ecs/database/deep-extends-chain.type-test.d.ts +256 -256
  43. package/dist/ecs/database/index-api-proof.type-test.d.ts +1 -0
  44. package/dist/ecs/database/index-api-proof.type-test.js +88 -0
  45. package/dist/ecs/database/index-api-proof.type-test.js.map +1 -0
  46. package/dist/ecs/database/index-registry/create-index-registry.d.ts +53 -0
  47. package/dist/ecs/database/index-registry/create-index-registry.js +174 -0
  48. package/dist/ecs/database/index-registry/create-index-registry.js.map +1 -0
  49. package/dist/ecs/database/index-registry/create-index.d.ts +60 -0
  50. package/dist/ecs/database/index-registry/create-index.js +539 -0
  51. package/dist/ecs/database/index-registry/create-index.js.map +1 -0
  52. package/dist/ecs/database/index-registry/index.d.ts +4 -0
  53. package/dist/ecs/database/index-registry/index.js +4 -0
  54. package/dist/ecs/database/index-registry/index.js.map +1 -0
  55. package/dist/ecs/database/index.d.ts +1 -0
  56. package/dist/ecs/database/index.js +1 -0
  57. package/dist/ecs/database/index.js.map +1 -1
  58. package/dist/ecs/database/observe-index-entities.d.ts +26 -0
  59. package/dist/ecs/database/observe-index-entities.js +66 -0
  60. package/dist/ecs/database/observe-index-entities.js.map +1 -0
  61. package/dist/ecs/database/observed/create-observed-database.js +1 -1
  62. package/dist/ecs/database/observed/create-observed-database.js.map +1 -1
  63. package/dist/ecs/database/observed/observed-database.d.ts +1 -1
  64. package/dist/ecs/database/public/create-database.d.ts +12 -27
  65. package/dist/ecs/database/public/create-database.js +252 -10
  66. package/dist/ecs/database/public/create-database.js.map +1 -1
  67. package/dist/ecs/database/public/create-database.test.js +8 -7
  68. package/dist/ecs/database/public/create-database.test.js.map +1 -1
  69. package/dist/ecs/database/public/create-transaction-dispatcher.d.ts +4 -2
  70. package/dist/ecs/database/public/create-transaction-dispatcher.js +2 -8
  71. package/dist/ecs/database/public/create-transaction-dispatcher.js.map +1 -1
  72. package/dist/ecs/database/reconciling/create-rebase-replay-applier.d.ts +26 -0
  73. package/dist/ecs/database/reconciling/create-rebase-replay-applier.js +121 -0
  74. package/dist/ecs/database/reconciling/create-rebase-replay-applier.js.map +1 -0
  75. package/dist/ecs/database/reconciling/create-reconciling-database.d.ts +11 -0
  76. package/dist/ecs/database/reconciling/create-reconciling-database.js +28 -137
  77. package/dist/ecs/database/reconciling/create-reconciling-database.js.map +1 -1
  78. package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
  79. package/dist/ecs/database/transactional-store/transactional-store.d.ts +4 -3
  80. package/dist/ecs/entity-location-table/create-entity-location-table.js +2 -2
  81. package/dist/ecs/entity-location-table/create-entity-location-table.js.map +1 -1
  82. package/dist/ecs/entity-location-table/entity-location-table.d.ts +7 -1
  83. package/dist/ecs/plugins/scheduler/scheduler.d.ts +1 -0
  84. package/dist/ecs/store/core/core.d.ts +7 -1
  85. package/dist/ecs/store/core/create-core.js +3 -3
  86. package/dist/ecs/store/core/create-core.js.map +1 -1
  87. package/dist/ecs/store/index-types.d.ts +142 -0
  88. package/dist/ecs/store/index-types.js +3 -0
  89. package/dist/ecs/store/index-types.js.map +1 -0
  90. package/dist/ecs/store/public/create-store.js +206 -4
  91. package/dist/ecs/store/public/create-store.js.map +1 -1
  92. package/dist/ecs/store/public/create-store.test.js +25 -0
  93. package/dist/ecs/store/public/create-store.test.js.map +1 -1
  94. package/dist/ecs/store/store.d.ts +38 -14
  95. package/dist/ecs/store/store.js +5 -4
  96. package/dist/ecs/store/store.js.map +1 -1
  97. package/dist/ecs/store/transaction-functions.d.ts +4 -3
  98. package/dist/schema/fractional-index/between-n.d.ts +2 -0
  99. package/dist/schema/fractional-index/between-n.js +34 -0
  100. package/dist/schema/fractional-index/between-n.js.map +1 -0
  101. package/dist/schema/fractional-index/between-n.test.d.ts +1 -0
  102. package/dist/schema/fractional-index/between-n.test.js +36 -0
  103. package/dist/schema/fractional-index/between-n.test.js.map +1 -0
  104. package/dist/schema/fractional-index/between.d.ts +2 -0
  105. package/dist/schema/fractional-index/between.js +3 -0
  106. package/dist/schema/fractional-index/between.js.map +1 -0
  107. package/dist/schema/fractional-index/between.test.d.ts +1 -0
  108. package/dist/schema/fractional-index/between.test.js +68 -0
  109. package/dist/schema/fractional-index/between.test.js.map +1 -0
  110. package/dist/schema/fractional-index/decrement-integer.d.ts +1 -0
  111. package/dist/schema/fractional-index/decrement-integer.js +32 -0
  112. package/dist/schema/fractional-index/decrement-integer.js.map +1 -0
  113. package/dist/schema/fractional-index/decrement-integer.test.d.ts +1 -0
  114. package/dist/schema/fractional-index/decrement-integer.test.js +31 -0
  115. package/dist/schema/fractional-index/decrement-integer.test.js.map +1 -0
  116. package/dist/schema/fractional-index/digits.d.ts +1 -0
  117. package/dist/schema/fractional-index/digits.js +3 -0
  118. package/dist/schema/fractional-index/digits.js.map +1 -0
  119. package/dist/schema/fractional-index/fractional-index.d.ts +4 -0
  120. package/dist/schema/fractional-index/fractional-index.js +2 -0
  121. package/dist/schema/fractional-index/fractional-index.js.map +1 -0
  122. package/dist/schema/fractional-index/increment-integer.d.ts +1 -0
  123. package/dist/schema/fractional-index/increment-integer.js +32 -0
  124. package/dist/schema/fractional-index/increment-integer.js.map +1 -0
  125. package/dist/schema/fractional-index/increment-integer.test.d.ts +1 -0
  126. package/dist/schema/fractional-index/increment-integer.test.js +34 -0
  127. package/dist/schema/fractional-index/increment-integer.test.js.map +1 -0
  128. package/dist/schema/fractional-index/initial.d.ts +2 -0
  129. package/dist/schema/fractional-index/initial.js +2 -0
  130. package/dist/schema/fractional-index/initial.js.map +1 -0
  131. package/dist/schema/fractional-index/integer-length.d.ts +1 -0
  132. package/dist/schema/fractional-index/integer-length.js +9 -0
  133. package/dist/schema/fractional-index/integer-length.js.map +1 -0
  134. package/dist/schema/fractional-index/integer-part.d.ts +1 -0
  135. package/dist/schema/fractional-index/integer-part.js +9 -0
  136. package/dist/schema/fractional-index/integer-part.js.map +1 -0
  137. package/dist/schema/fractional-index/key-between.d.ts +2 -0
  138. package/dist/schema/fractional-index/key-between.js +39 -0
  139. package/dist/schema/fractional-index/key-between.js.map +1 -0
  140. package/dist/schema/fractional-index/midpoint.d.ts +1 -0
  141. package/dist/schema/fractional-index/midpoint.js +23 -0
  142. package/dist/schema/fractional-index/midpoint.js.map +1 -0
  143. package/dist/schema/fractional-index/midpoint.test.d.ts +1 -0
  144. package/dist/schema/fractional-index/midpoint.test.js +83 -0
  145. package/dist/schema/fractional-index/midpoint.test.js.map +1 -0
  146. package/dist/schema/fractional-index/public.d.ts +4 -0
  147. package/dist/schema/fractional-index/public.js +6 -0
  148. package/dist/schema/fractional-index/public.js.map +1 -0
  149. package/dist/schema/fractional-index/schema.d.ts +4 -0
  150. package/dist/schema/fractional-index/schema.js +5 -0
  151. package/dist/schema/fractional-index/schema.js.map +1 -0
  152. package/dist/schema/fractional-index/smallest-integer.d.ts +1 -0
  153. package/dist/schema/fractional-index/smallest-integer.js +3 -0
  154. package/dist/schema/fractional-index/smallest-integer.js.map +1 -0
  155. package/dist/schema/fractional-index/validate-integer.d.ts +1 -0
  156. package/dist/schema/fractional-index/validate-integer.js +7 -0
  157. package/dist/schema/fractional-index/validate-integer.js.map +1 -0
  158. package/dist/schema/fractional-index/validate-order-key.d.ts +1 -0
  159. package/dist/schema/fractional-index/validate-order-key.js +11 -0
  160. package/dist/schema/fractional-index/validate-order-key.js.map +1 -0
  161. package/dist/schema/guid/create.d.ts +2 -0
  162. package/dist/schema/guid/create.js +10 -0
  163. package/dist/schema/guid/create.js.map +1 -0
  164. package/dist/schema/guid/create.test.d.ts +1 -0
  165. package/dist/schema/guid/create.test.js +39 -0
  166. package/dist/schema/guid/create.test.js.map +1 -0
  167. package/dist/schema/guid/equals.d.ts +2 -0
  168. package/dist/schema/guid/equals.js +3 -0
  169. package/dist/schema/guid/equals.js.map +1 -0
  170. package/dist/schema/guid/equals.test.d.ts +1 -0
  171. package/dist/schema/guid/equals.test.js +30 -0
  172. package/dist/schema/guid/equals.test.js.map +1 -0
  173. package/dist/schema/guid/from-uuid.d.ts +2 -0
  174. package/dist/schema/guid/from-uuid.js +15 -0
  175. package/dist/schema/guid/from-uuid.js.map +1 -0
  176. package/dist/schema/guid/from-uuid.test.d.ts +1 -0
  177. package/dist/schema/guid/from-uuid.test.js +39 -0
  178. package/dist/schema/guid/from-uuid.test.js.map +1 -0
  179. package/dist/schema/guid/guid.performance.test.d.ts +1 -0
  180. package/dist/schema/guid/guid.performance.test.js +297 -0
  181. package/dist/schema/guid/guid.performance.test.js.map +1 -0
  182. package/dist/schema/guid/index.d.ts +4 -0
  183. package/dist/schema/guid/index.js +3 -0
  184. package/dist/schema/guid/index.js.map +1 -0
  185. package/dist/schema/guid/layout.d.ts +1 -0
  186. package/dist/schema/guid/layout.js +5 -0
  187. package/dist/schema/guid/layout.js.map +1 -0
  188. package/dist/schema/guid/nil.d.ts +2 -0
  189. package/dist/schema/guid/nil.js +3 -0
  190. package/dist/schema/guid/nil.js.map +1 -0
  191. package/dist/schema/guid/public.d.ts +8 -0
  192. package/dist/schema/guid/public.js +10 -0
  193. package/dist/schema/guid/public.js.map +1 -0
  194. package/dist/schema/guid/schema.d.ts +12 -0
  195. package/dist/schema/guid/schema.js +10 -0
  196. package/dist/schema/guid/schema.js.map +1 -0
  197. package/dist/schema/guid/schema.test.d.ts +1 -0
  198. package/dist/schema/guid/schema.test.js +35 -0
  199. package/dist/schema/guid/schema.test.js.map +1 -0
  200. package/dist/schema/guid/to-unserializable-key.d.ts +2 -0
  201. package/dist/schema/guid/to-unserializable-key.js +10 -0
  202. package/dist/schema/guid/to-unserializable-key.js.map +1 -0
  203. package/dist/schema/guid/to-uuid.d.ts +2 -0
  204. package/dist/schema/guid/to-uuid.js +15 -0
  205. package/dist/schema/guid/to-uuid.js.map +1 -0
  206. package/dist/schema/guid/to-uuid.test.d.ts +1 -0
  207. package/dist/schema/guid/to-uuid.test.js +31 -0
  208. package/dist/schema/guid/to-uuid.test.js.map +1 -0
  209. package/dist/schema/index.d.ts +2 -0
  210. package/dist/schema/index.js +2 -0
  211. package/dist/schema/index.js.map +1 -1
  212. package/dist/table/select-rows.d.ts +7 -4
  213. package/dist/table/select-rows.js.map +1 -1
  214. package/dist/test-setup.js +2 -2
  215. package/dist/test-setup.js.map +1 -1
  216. package/dist/tsconfig.tsbuildinfo +1 -1
  217. package/package.json +3 -1
  218. package/references/data-lit/package.json +1 -1
  219. package/references/data-lit-tictactoe/package.json +1 -1
  220. package/references/data-react/package.json +1 -1
  221. package/references/data-react-hello/package.json +1 -1
  222. package/references/data-react-pixie/package.json +1 -1
@@ -0,0 +1,417 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ import { describe, expect, it } from "vitest";
3
+ import { Database } from "./database.js";
4
+ /**
5
+ * Big-O verification for index insertion paths.
6
+ *
7
+ * For each declaration shape, we insert `N` rows and check that doubling
8
+ * `N` doubles total time (linear in `N`, i.e. amortized `O(1)` per insert)
9
+ * rather than scaling quadratically. The test compares the ratio between
10
+ * the two batches' insert times against a quadratic-growth threshold.
11
+ *
12
+ * Each test inserts BEFORE any read so the deferred-sort path stays on
13
+ * its happy path: writes are O(1) append + dirty-set membership; the sort
14
+ * only happens when a read drains a dirty bucket.
15
+ *
16
+ * Timing on CI varies, so we use a generous slack and skip when the
17
+ * timer can't resolve a meaningful value (sub-millisecond). When the
18
+ * test does measure, it asserts the time ratio between N and 2N is
19
+ * below `quadratic_floor`, i.e. nowhere near `O(n²)`.
20
+ */
21
+ const SIZES = [2000, 4000];
22
+ // Doubling N: a truly linear operation gives ~2× total time; an O(n²)
23
+ // regression gives ~4×. We allow up to 5× to absorb GC pauses and JIT
24
+ // warmup variance when the suite runs alongside the rest of the repo,
25
+ // while still flagging a quadratic regression with margin (it would
26
+ // reliably exceed 4×, often by a lot, as N grows).
27
+ const QUADRATIC_FLOOR = 5.0;
28
+ function measureMs(fn) {
29
+ const start = performance.now();
30
+ fn();
31
+ return performance.now() - start;
32
+ }
33
+ /**
34
+ * Run `fn` once to warm V8's JIT and any per-fixture cold paths, then run
35
+ * it again and return the measured time. Without this, the first invocation
36
+ * in a SIZES.map sees cold optimization and skews the linear-growth ratio,
37
+ * particularly when this suite runs alongside the full repo's other tests.
38
+ */
39
+ function warmThenMeasure(fn) {
40
+ fn();
41
+ return fn();
42
+ }
43
+ function expectAmortizedLinear(times) {
44
+ if (times.some(t => t <= 1)) {
45
+ // Below the resolution we trust — skip the assertion but the
46
+ // test still verified the inserts ran without throwing.
47
+ return;
48
+ }
49
+ const ratio = times[1] / times[0];
50
+ expect(ratio).toBeLessThan(QUADRATIC_FLOOR);
51
+ }
52
+ describe("Index insertion big-O", () => {
53
+ it("non-unique single-column key (O(1) push per insert)", () => {
54
+ const times = SIZES.map((n) => warmThenMeasure(() => {
55
+ const plugin = Database.Plugin.create({
56
+ components: { parent: { type: "number" } },
57
+ archetypes: { Child: ["parent"] },
58
+ indexes: { childrenOf: { key: "parent" } },
59
+ transactions: {
60
+ add: (t, p) => t.archetypes.Child.insert({ parent: p }),
61
+ },
62
+ });
63
+ const db = Database.create(plugin);
64
+ return measureMs(() => {
65
+ for (let i = 0; i < n; i++)
66
+ db.transactions.add(0); // all in one bucket
67
+ });
68
+ }));
69
+ expectAmortizedLinear(times);
70
+ });
71
+ it("unique single-column key (O(1) Map set per insert)", () => {
72
+ const times = SIZES.map((n) => warmThenMeasure(() => {
73
+ const plugin = Database.Plugin.create({
74
+ components: { sku: { type: "number" } },
75
+ archetypes: { Row: ["sku"] },
76
+ indexes: { bySku: { key: "sku", unique: true } },
77
+ transactions: {
78
+ add: (t, sku) => t.archetypes.Row.insert({ sku }),
79
+ },
80
+ });
81
+ const db = Database.create(plugin);
82
+ return measureMs(() => {
83
+ for (let i = 0; i < n; i++)
84
+ db.transactions.add(i); // distinct keys
85
+ });
86
+ }));
87
+ expectAmortizedLinear(times);
88
+ });
89
+ it("sorted single-key (deferred: O(1) append + dirty mark per insert)", () => {
90
+ // This is the key case for deferred sort: many inserts into the
91
+ // same sorted bucket should be linear in batch size, not quadratic.
92
+ const times = SIZES.map((n) => warmThenMeasure(() => {
93
+ const plugin = Database.Plugin.create({
94
+ components: {
95
+ parent: { type: "number" },
96
+ fractIndex: { type: "string" },
97
+ },
98
+ archetypes: { Child: ["parent", "fractIndex"] },
99
+ indexes: {
100
+ ordered: { key: "parent", order: { by: ["fractIndex"] } },
101
+ },
102
+ transactions: {
103
+ add: (t, fractIndex) => t.archetypes.Child.insert({ parent: 0, fractIndex }),
104
+ },
105
+ });
106
+ const db = Database.create(plugin);
107
+ return measureMs(() => {
108
+ // Insert in reverse-sorted order to stress the comparator
109
+ // path. With deferred sort we never call the comparator
110
+ // during inserts — only on the (deferred) read.
111
+ for (let i = n - 1; i >= 0; i--) {
112
+ db.transactions.add(String(i).padStart(8, "0"));
113
+ }
114
+ });
115
+ }));
116
+ expectAmortizedLinear(times);
117
+ });
118
+ it("sorted multi-key with custom comparator (deferred)", () => {
119
+ const times = SIZES.map((n) => warmThenMeasure(() => {
120
+ const plugin = Database.Plugin.create({
121
+ components: {
122
+ owner: { type: "number" },
123
+ priority: { type: "number" },
124
+ due: { type: "number" },
125
+ },
126
+ archetypes: { Task: ["owner", "priority", "due"] },
127
+ indexes: {
128
+ tasksByPriority: {
129
+ key: "owner",
130
+ order: {
131
+ by: ["priority", "due"],
132
+ compare: (a, b) => b.priority - a.priority || a.due - b.due,
133
+ },
134
+ },
135
+ },
136
+ transactions: {
137
+ add: (t, args) => t.archetypes.Task.insert({
138
+ owner: 0,
139
+ priority: args.priority,
140
+ due: args.due,
141
+ }),
142
+ },
143
+ });
144
+ const db = Database.create(plugin);
145
+ return measureMs(() => {
146
+ for (let i = 0; i < n; i++) {
147
+ db.transactions.add({ priority: n - i, due: i });
148
+ }
149
+ });
150
+ }));
151
+ expectAmortizedLinear(times);
152
+ });
153
+ it("multi-value array fan-out (O(elements-per-row) per insert)", () => {
154
+ // Fan-out cost is proportional to the array size per row, not to
155
+ // the total dataset size. Keep the array size constant; insertion
156
+ // time should still be linear in N.
157
+ const times = SIZES.map((n) => warmThenMeasure(() => {
158
+ const plugin = Database.Plugin.create({
159
+ components: {
160
+ title: { type: "string" },
161
+ assigned: { type: "array", items: { type: "string" } },
162
+ },
163
+ archetypes: { Task: ["title", "assigned"] },
164
+ indexes: { tasksByAssignee: { key: "assigned" } },
165
+ transactions: {
166
+ add: (t, args) => t.archetypes.Task.insert(args),
167
+ },
168
+ });
169
+ const db = Database.create(plugin);
170
+ return measureMs(() => {
171
+ for (let i = 0; i < n; i++) {
172
+ db.transactions.add({
173
+ title: `t${i}`,
174
+ assigned: ["a", "b", "c"],
175
+ });
176
+ }
177
+ });
178
+ }));
179
+ expectAmortizedLinear(times);
180
+ });
181
+ it("computed scalar key (O(compute) per insert)", () => {
182
+ const times = SIZES.map((n) => warmThenMeasure(() => {
183
+ const plugin = Database.Plugin.create({
184
+ components: { email: { type: "string" } },
185
+ archetypes: { User: ["email"] },
186
+ indexes: {
187
+ byEmailCi: {
188
+ key: (email) => email.toLowerCase(),
189
+ components: ["email"],
190
+ },
191
+ },
192
+ transactions: {
193
+ add: (t, email) => t.archetypes.User.insert({ email }),
194
+ },
195
+ });
196
+ const db = Database.create(plugin);
197
+ return measureMs(() => {
198
+ for (let i = 0; i < n; i++)
199
+ db.transactions.add(`User${i}@X.com`);
200
+ });
201
+ }));
202
+ expectAmortizedLinear(times);
203
+ });
204
+ it("computed multi-value (O(elements + compute) per insert)", () => {
205
+ const times = SIZES.map((n) => warmThenMeasure(() => {
206
+ const plugin = Database.Plugin.create({
207
+ components: { body: { type: "string" } },
208
+ archetypes: { Doc: ["body"] },
209
+ indexes: {
210
+ docsByKeyword: {
211
+ key: (body) => body.split(/\s+/),
212
+ components: ["body"],
213
+ },
214
+ },
215
+ transactions: {
216
+ add: (t, body) => t.archetypes.Doc.insert({ body }),
217
+ },
218
+ });
219
+ const db = Database.create(plugin);
220
+ return measureMs(() => {
221
+ for (let i = 0; i < n; i++)
222
+ db.transactions.add("alpha beta gamma");
223
+ });
224
+ }));
225
+ expectAmortizedLinear(times);
226
+ });
227
+ it("slot map key (O(slots) per insert)", () => {
228
+ const times = SIZES.map((n) => warmThenMeasure(() => {
229
+ const plugin = Database.Plugin.create({
230
+ components: {
231
+ team: { type: "number" },
232
+ roster: {
233
+ type: "object",
234
+ properties: { role: { type: "string" } },
235
+ required: ["role"],
236
+ },
237
+ },
238
+ archetypes: { Player: ["team", "roster"] },
239
+ indexes: {
240
+ playerByTeamRole: {
241
+ key: {
242
+ team: "team",
243
+ role: (r) => r.role,
244
+ },
245
+ components: ["roster"],
246
+ },
247
+ },
248
+ transactions: {
249
+ add: (t, args) => t.archetypes.Player.insert(args),
250
+ },
251
+ });
252
+ const db = Database.create(plugin);
253
+ return measureMs(() => {
254
+ for (let i = 0; i < n; i++) {
255
+ db.transactions.add({ team: i, roster: { role: "qb" } });
256
+ }
257
+ });
258
+ }));
259
+ expectAmortizedLinear(times);
260
+ });
261
+ });
262
+ describe("Single-entity write is O(1) in bucket size", () => {
263
+ // These tests catch regressions where a single-row delete/update
264
+ // becomes proportional to the bucket size (e.g. via `arr.indexOf`).
265
+ // We compare two bucket sizes ~10× apart; if the per-delete cost
266
+ // were linear in bucket size, the ratio would be ~10× and exceed
267
+ // the threshold. With O(1) bucket-removal it stays near 1×.
268
+ const SMALL = 4_000;
269
+ const BIG = 40_000;
270
+ const DELETES = 2_000;
271
+ function pickTargets(bucketSize, count) {
272
+ // Targets scattered through the bucket — front, middle, back, with
273
+ // a step. If we picked only the first K, `arr.indexOf` would hit
274
+ // index 0 immediately and the linear-scan cost wouldn't show up.
275
+ const stride = Math.max(1, Math.floor(bucketSize / count));
276
+ const out = [];
277
+ for (let i = 0; i < count; i++)
278
+ out.push(i * stride);
279
+ return out;
280
+ }
281
+ function timeDeletes(bucketSize) {
282
+ const plugin = Database.Plugin.create({
283
+ components: { parent: { type: "number" } },
284
+ archetypes: { Child: ["parent"] },
285
+ indexes: { childrenOf: { key: "parent" } },
286
+ transactions: {
287
+ add: (t, p) => t.archetypes.Child.insert({ parent: p }),
288
+ delete: (t, e) => t.delete(e),
289
+ },
290
+ });
291
+ const db = Database.create(plugin);
292
+ const entities = [];
293
+ for (let i = 0; i < bucketSize; i++) {
294
+ entities.push(db.transactions.add(0));
295
+ }
296
+ const targets = pickTargets(bucketSize, DELETES).map((i) => entities[i]);
297
+ return measureMs(() => {
298
+ for (const e of targets)
299
+ db.transactions.delete(e);
300
+ });
301
+ }
302
+ function timeUpdatesBucketChange(bucketSize) {
303
+ const plugin = Database.Plugin.create({
304
+ components: { parent: { type: "number" } },
305
+ archetypes: { Child: ["parent"] },
306
+ indexes: { childrenOf: { key: "parent" } },
307
+ transactions: {
308
+ add: (t, p) => t.archetypes.Child.insert({ parent: p }),
309
+ move: (t, args) => t.update(args.e, { parent: args.p }),
310
+ },
311
+ });
312
+ const db = Database.create(plugin);
313
+ const entities = [];
314
+ for (let i = 0; i < bucketSize; i++) {
315
+ entities.push(db.transactions.add(0));
316
+ }
317
+ const targets = pickTargets(bucketSize, DELETES).map((i) => entities[i]);
318
+ return measureMs(() => {
319
+ let p = 1;
320
+ for (const e of targets)
321
+ db.transactions.move({ e, p: p++ });
322
+ });
323
+ }
324
+ it("non-unique delete: small vs big bucket — ratio stays near 1×", () => {
325
+ const small = warmThenMeasure(() => timeDeletes(SMALL));
326
+ const big = warmThenMeasure(() => timeDeletes(BIG));
327
+ if (small <= 1)
328
+ return; // sub-ms; can't measure reliably
329
+ // O(bucket.size) would give ratio ~= BIG/SMALL = 10×. O(1) → ~1×.
330
+ // Threshold 3 is permissive enough for CI noise but rejects linear.
331
+ expect(big / small).toBeLessThan(3);
332
+ });
333
+ it("update-with-bucket-change: small vs big source bucket — ratio stays near 1×", () => {
334
+ const small = warmThenMeasure(() => timeUpdatesBucketChange(SMALL));
335
+ const big = warmThenMeasure(() => timeUpdatesBucketChange(BIG));
336
+ if (small <= 1)
337
+ return;
338
+ expect(big / small).toBeLessThan(3);
339
+ });
340
+ it("sorted-index delete: small vs big bucket — ratio stays near 1×", () => {
341
+ // Sorted indexes used arr.splice with indexOf in the V1 path —
342
+ // O(bucket.size) per delete. Now Set.delete is O(1); the sort
343
+ // cache is invalidated, paid only on the next read.
344
+ function timeSortedDeletes(bucketSize) {
345
+ const plugin = Database.Plugin.create({
346
+ components: {
347
+ parent: { type: "number" },
348
+ fractIndex: { type: "string" },
349
+ },
350
+ archetypes: { Child: ["parent", "fractIndex"] },
351
+ indexes: {
352
+ ordered: { key: "parent", order: { by: ["fractIndex"] } },
353
+ },
354
+ transactions: {
355
+ add: (t, fractIndex) => t.archetypes.Child.insert({ parent: 0, fractIndex }),
356
+ delete: (t, e) => t.delete(e),
357
+ },
358
+ });
359
+ const db = Database.create(plugin);
360
+ const entities = [];
361
+ for (let i = 0; i < bucketSize; i++) {
362
+ entities.push(db.transactions.add(String(i).padStart(8, "0")));
363
+ }
364
+ const targets = pickTargets(bucketSize, DELETES).map((i) => entities[i]);
365
+ return measureMs(() => {
366
+ for (const e of targets)
367
+ db.transactions.delete(e);
368
+ });
369
+ }
370
+ const small = warmThenMeasure(() => timeSortedDeletes(SMALL));
371
+ const big = warmThenMeasure(() => timeSortedDeletes(BIG));
372
+ if (small <= 1)
373
+ return;
374
+ expect(big / small).toBeLessThan(3);
375
+ });
376
+ });
377
+ describe("Index read after batched inserts", () => {
378
+ it("sorted read after N inserts pays exactly one O(n log n) sort then is free", () => {
379
+ // The deferred-sort contract: the FIRST find/findRange on a dirty
380
+ // bucket pays the catch-up sort; the second is free. We verify by
381
+ // measuring two consecutive reads.
382
+ const n = 5000;
383
+ const plugin = Database.Plugin.create({
384
+ components: {
385
+ parent: { type: "number" },
386
+ fractIndex: { type: "string" },
387
+ },
388
+ archetypes: { Child: ["parent", "fractIndex"] },
389
+ indexes: {
390
+ ordered: { key: "parent", order: { by: ["fractIndex"] } },
391
+ },
392
+ transactions: {
393
+ add: (t, fractIndex) => t.archetypes.Child.insert({ parent: 0, fractIndex }),
394
+ },
395
+ });
396
+ const db = Database.create(plugin);
397
+ for (let i = n - 1; i >= 0; i--) {
398
+ db.transactions.add(String(i).padStart(8, "0"));
399
+ }
400
+ const firstReadTime = measureMs(() => {
401
+ const out = db.indexes.ordered.find(0);
402
+ expect(out.length).toBe(n);
403
+ // Verify the sort actually happened.
404
+ expect(out[0]).toBeDefined();
405
+ });
406
+ const secondReadTime = measureMs(() => {
407
+ const out = db.indexes.ordered.find(0);
408
+ expect(out.length).toBe(n);
409
+ });
410
+ // The second read should be at least an order of magnitude
411
+ // cheaper than the first. Allow generous slack for noise.
412
+ if (firstReadTime > 1) {
413
+ expect(secondReadTime).toBeLessThan(firstReadTime);
414
+ }
415
+ });
416
+ });
417
+ //# sourceMappingURL=database.index.performance.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.index.performance.test.js","sourceRoot":"","sources":["../../../src/ecs/database/database.index.performance.test.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3B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