Repository navigation
Commit 0fdee60
a write snapshots only what it changed; a clean state resolves its saved epoch once (#70)
* a write snapshots only what it changed; a clean state resolves its saved epoch once
Two costs that grew with every registered state, measured in Toad's Qt client:
- record_snapshot found which clean scopes share an object with a changed one by
deep-copying every registered state's values on every write, though it copies
only the changed ones. Each scope now keeps the objects its values reached when
it was last captured (SnapshotReach, which holds them so their ids stay theirs).
A scope left clean keeps that capture in the next snapshot and reaches the same
objects, so only the scopes being captured are walked. A clean scope that shares
an object with one of them is still captured with it, and time travel forgets
what scopes reached, since restored scopes hold copies.
- A state opened or saved under ancestors holding exactly their saved parameters
resolved every field twice in __init__ (live, then saved) and again in
mark_saved. While this state and every registered ancestor are not raw-dirty,
both epochs read the same values, so the saved epoch is the live snapshot,
copied as the saved parameters are (a live value changed in place stays dirty).
Otherwise it is resolved on its own, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
* lint: dict annotations, the sharing scope registered without an unused name, one long line wrapped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 93c87f4 commit 0fdee60
3 files changed
Lines changed: 134 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
2051 | 2051 | | |
2052 | 2052 | | |
2053 | 2053 | | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
2054 | 2082 | | |
2055 | 2083 | | |
2056 | 2084 | | |
| |||
2243 | 2271 | | |
2244 | 2272 | | |
2245 | 2273 | | |
2246 | | - | |
| 2274 | + | |
2247 | 2275 | | |
2248 | 2276 | | |
2249 | 2277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
45 | 61 | | |
46 | 62 | | |
47 | 63 | | |
| |||
215 | 231 | | |
216 | 232 | | |
217 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
218 | 239 | | |
219 | 240 | | |
220 | 241 | | |
| |||
585 | 606 | | |
586 | 607 | | |
587 | 608 | | |
| 609 | + | |
588 | 610 | | |
589 | 611 | | |
590 | 612 | | |
| |||
1248 | 1270 | | |
1249 | 1271 | | |
1250 | 1272 | | |
1251 | | - | |
1252 | | - | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
1253 | 1277 | | |
1254 | 1278 | | |
1255 | 1279 | | |
| |||
1258 | 1282 | | |
1259 | 1283 | | |
1260 | 1284 | | |
1261 | | - | |
1262 | | - | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
1263 | 1294 | | |
1264 | 1295 | | |
1265 | 1296 | | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
1271 | | - | |
1272 | | - | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
1281 | | - | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
1282 | 1325 | | |
1283 | 1326 | | |
1284 | 1327 | | |
| |||
1967 | 2010 | | |
1968 | 2011 | | |
1969 | 2012 | | |
| 2013 | + | |
| 2014 | + | |
1970 | 2015 | | |
1971 | 2016 | | |
1972 | 2017 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
0 commit comments