clay: make +pick fast

This commit is contained in:
Philip Monk 2022-04-06 23:16:26 -07:00
parent 84ccf60b19
commit 7482717c02
2 changed files with 86 additions and 59 deletions

View File

@ -812,6 +812,8 @@
+$ clue :: murder weapon +$ clue :: murder weapon
$% [%lobe =lobe] :: specific lobe $% [%lobe =lobe] :: specific lobe
[%all ~] :: all safe targets [%all ~] :: all safe targets
[%pick ~] :: collect garbage
[%norm =ship =desk =norm] :: set norm
== :: == ::
+$ crew (set ship) :: permissions group +$ crew (set ship) :: permissions group
+$ dict [src=path rul=real] :: effective permission +$ dict [src=path rul=real] :: effective permission
@ -861,6 +863,7 @@
$% [%& p=suba] :: delta $% [%& p=suba] :: delta
[%| p=@tas] :: label [%| p=@tas] :: label
== :: == ::
+$ norm (axal ?) :: tombstone policy
+$ open $-(path vase) :: get prelude +$ open $-(path vase) :: get prelude
+$ page (cask *) :: untyped cage +$ page (cask *) :: untyped cage
+$ plop blub :: unvalidated blob +$ plop blub :: unvalidated blob

View File

@ -177,9 +177,6 @@
bar=(set plop) :: new content bar=(set plop) :: new content
== :: == ::
:: ::
:: Tombstone policy
::
+$ norm (axal ?)
:: ::
:: Formal vane state. :: Formal vane state.
:: ::
@ -1466,6 +1463,11 @@
== ==
== ==
:: ::
++ set-norm
|= =norm
=. nor.dom norm
..park
::
:: Attach label to aeon :: Attach label to aeon
:: ::
++ label ++ label
@ -5259,6 +5261,13 @@
`..^^$ `..^^$
=. ..^^$ (tomb-lobe lobe.i.lobes &) =. ..^^$ (tomb-lobe lobe.i.lobes &)
$(lobes t.lobes) $(lobes t.lobes)
::
%pick pick
%norm
=^ mos ruf
=/ den ((de now rof *duct ruf) ship.clue desk.clue)
abet:(set-norm:den norm.clue)
[mos ..^$]
== ==
:: +tomb-lobe: remove specific lobe :: +tomb-lobe: remove specific lobe
:: ::
@ -5318,45 +5327,10 @@
..^$ ..^$
((slog tang) ..^$) ((slog tang) ..^$)
:: ::
:: +pick: copying gc based on norms
::
:: Could reduce uni costs throughout by keeping an explicit cache
::
++ pick
^- (map lobe blob)
|^
=/ room-blobs
=/ rooms=(list [=desk =dojo]) ~(tap by dos.rom.ruf)
|- ^- (map lobe blob)
?~ rooms
~
(uni-blobs $(rooms t.rooms) (pick-dome dom.dojo.i.rooms))
=/ rung-blobs
=/ rungs=(list [=ship =rung]) ~(tap by hoy.ruf)
|- ^- (map lobe blob)
?~ rungs
~
%+ uni-blobs $(rungs t.rungs)
=/ redes=(list [=desk =rede]) ~(tap by rus.rung.i.rungs)
|-
?~ redes
~
(uni-blobs $(redes t.redes) (pick-dome dom.rede.i.redes))
(uni-blobs room-blobs rung-blobs)
::
++ pick-dome
|= =dome
^- (map lobe blob)
=/ yakis=(list [=norm =yaki]) ~(tap in (draw-dome dome))
|- ^- (map lobe blob)
?~ yakis
~
(uni-blobs $(yakis t.yakis) (pick-yaki i.yakis))
::
++ draw-dome ++ draw-dome
|= =dome |= =dome
^- (set [norm yaki]) ^- (set [norm yaki])
=| =aeon =/ =aeon 1
|- ^- (set [norm yaki]) |- ^- (set [norm yaki])
?: (lth let.dome aeon) ?: (lth let.dome aeon)
~ ~
@ -5376,17 +5350,67 @@
(~(uni in $(p.yaki t.p.yaki)) ^$(tako i.p.yaki)) (~(uni in $(p.yaki t.p.yaki)) ^$(tako i.p.yaki))
(~(put in takos) norm yaki) (~(put in takos) norm yaki)
:: ::
::
:: +pick: copying gc based on norms
::
++ pick
=| lat=(map lobe blob)
=| sen=(set (map path lobe))
|^
=. ..pick-raft pick-raft
=. lat.ran.ruf lat
`..^$
::
++ pick-raft
^+ ..pick-raft
=. ..pick-raft
=/ rooms=(list [=desk =dojo]) ~(tap by dos.rom.ruf)
|- ^+ ..pick-raft
?~ rooms
..pick-raft
$(rooms t.rooms, ..pick-raft (pick-dome dom.dojo.i.rooms))
=. ..pick-raft
=/ rungs=(list [=ship =rung]) ~(tap by hoy.ruf)
|- ^+ ..pick-raft
?~ rungs
..pick-raft
=. ..pick-raft
=/ redes=(list [=desk =rede]) ~(tap by rus.rung.i.rungs)
|-
?~ redes
..pick-raft
$(redes t.redes, ..pick-raft (pick-dome dom.rede.i.redes))
$(rungs t.rungs)
..pick-raft
::
++ pick-dome
|= =dome
^+ ..pick-raft
=/ yakis=(list [=norm =yaki]) ~(tap in (draw-dome dome))
|- ^+ ..pick-raft
?~ yakis
..pick-raft
$(yakis t.yakis, ..pick-raft (pick-yaki i.yakis))
::
:: NB: recurring in this way with the `sen` cache provides
:: approximately a 100x speedup on a mainnet moon in 4/2022
::
++ pick-yaki ++ pick-yaki
|= [=norm =yaki] |= [=norm =yaki]
^- (map lobe blob) ^+ ..pick-raft
=/ lobes=(list [=path =lobe]) ~(tap by q.yaki) |- ^+ ..pick-raft
|- ^- (map ^lobe blob) ?~ q.yaki
?~ lobes ..pick-raft
~ ?: (~(has in sen) q.yaki)
%+ uni-blobs $(lobes t.lobes) ..pick-raft
?: =([~ %&] +:(~(fit ^de norm) path.i.lobes)) =. sen (~(put in sen) q.yaki)
(pick-lobe lobe.i.lobes) =/ bob (~(get by lat) q.n.q.yaki)
[[lobe.i.lobes %dead lobe.i.lobes ~] ~ ~] =? lat ?|(?=(~ bob) ?=([~ %dead *] bob))
?: =([~ %&] +:(~(fit ^de norm) p.n.q.yaki))
(uni-blobs lat (pick-lobe q.n.q.yaki))
(~(put by lat) q.n.q.yaki %dead q.n.q.yaki ~)
=. ..pick-raft $(q.yaki l.q.yaki)
$(q.yaki r.q.yaki)
:: ::
++ pick-lobe ++ pick-lobe
|= =lobe |= =lobe