Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
struct ScanBuffer:
var samples: List[Int]
def __init__(out self, var samples: List[Int]):
self.samples = samples^
def push(mut self, t: Int):
self.samples.append(t)
def size(self) -> Int:
return len(self.samples)
def main():
var original: List[Int] = [1, 2, 3]
var snapshot = ScanBuffer(original^)
# The black-box recorder keeps an independent copy so later edits don't leak in.
var working = snapshot.copy()
working.push(99)
print("snapshot size:", snapshot.size())
print("working size:", working.size())