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,75 +5327,90 @@
..^$ ..^$
((slog tang) ..^$) ((slog tang) ..^$)
:: ::
++ draw-dome
|= =dome
^- (set [norm yaki])
=/ =aeon 1
|- ^- (set [norm yaki])
?: (lth let.dome aeon)
~
=/ =tako (~(got by hit.dome) aeon)
(~(uni in (draw-tako tom.dome nor.dome tako)) $(aeon +(aeon)))
::
++ draw-tako
|= [tom=(map tako norm) nor=norm =tako]
^- (set [norm yaki])
~+
=/ =norm (~(gut by tom) tako nor)
=/ =yaki (~(got by hut.ran.ruf) tako)
=/ takos
|- ^- (set [^norm ^yaki])
?~ p.yaki
~
(~(uni in $(p.yaki t.p.yaki)) ^$(tako i.p.yaki))
(~(put in takos) norm yaki)
::
::
:: +pick: copying gc based on norms :: +pick: copying gc based on norms
:: ::
:: Could reduce uni costs throughout by keeping an explicit cache
::
++ pick ++ pick
^- (map lobe blob) =| lat=(map lobe blob)
=| sen=(set (map path lobe))
|^ |^
=/ room-blobs =. ..pick-raft pick-raft
=/ rooms=(list [=desk =dojo]) ~(tap by dos.rom.ruf) =. lat.ran.ruf lat
|- ^- (map lobe blob) `..^$
?~ rooms ::
~ ++ pick-raft
(uni-blobs $(rooms t.rooms) (pick-dome dom.dojo.i.rooms)) ^+ ..pick-raft
=/ rung-blobs =. ..pick-raft
=/ rungs=(list [=ship =rung]) ~(tap by hoy.ruf) =/ rooms=(list [=desk =dojo]) ~(tap by dos.rom.ruf)
|- ^- (map lobe blob) |- ^+ ..pick-raft
?~ rungs ?~ rooms
~ ..pick-raft
%+ uni-blobs $(rungs t.rungs) $(rooms t.rooms, ..pick-raft (pick-dome dom.dojo.i.rooms))
=/ redes=(list [=desk =rede]) ~(tap by rus.rung.i.rungs) =. ..pick-raft
|- =/ rungs=(list [=ship =rung]) ~(tap by hoy.ruf)
?~ redes |- ^+ ..pick-raft
~ ?~ rungs
(uni-blobs $(redes t.redes) (pick-dome dom.rede.i.redes)) ..pick-raft
(uni-blobs room-blobs rung-blobs) =. ..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 ++ pick-dome
|= =dome |= =dome
^- (map lobe blob) ^+ ..pick-raft
=/ yakis=(list [=norm =yaki]) ~(tap in (draw-dome dome)) =/ yakis=(list [=norm =yaki]) ~(tap in (draw-dome dome))
|- ^- (map lobe blob) |- ^+ ..pick-raft
?~ yakis ?~ yakis
~ ..pick-raft
(uni-blobs $(yakis t.yakis) (pick-yaki i.yakis)) $(yakis t.yakis, ..pick-raft (pick-yaki i.yakis))
:: ::
++ draw-dome :: NB: recurring in this way with the `sen` cache provides
|= =dome :: approximately a 100x speedup on a mainnet moon in 4/2022
^- (set [norm yaki])
=| =aeon
|- ^- (set [norm yaki])
?: (lth let.dome aeon)
~
=/ =tako (~(got by hit.dome) aeon)
(~(uni in (draw-tako tom.dome nor.dome tako)) $(aeon +(aeon)))
::
++ draw-tako
|= [tom=(map tako norm) nor=norm =tako]
^- (set [norm yaki])
~+
=/ =norm (~(gut by tom) tako nor)
=/ =yaki (~(got by hut.ran.ruf) tako)
=/ takos
|- ^- (set [^norm ^yaki])
?~ p.yaki
~
(~(uni in $(p.yaki t.p.yaki)) ^$(tako i.p.yaki))
(~(put in takos) norm yaki)
:: ::
++ 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