mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
clay: make +pick fast
This commit is contained in:
parent
84ccf60b19
commit
7482717c02
@ -812,6 +812,8 @@
|
||||
+$ clue :: murder weapon
|
||||
$% [%lobe =lobe] :: specific lobe
|
||||
[%all ~] :: all safe targets
|
||||
[%pick ~] :: collect garbage
|
||||
[%norm =ship =desk =norm] :: set norm
|
||||
== ::
|
||||
+$ crew (set ship) :: permissions group
|
||||
+$ dict [src=path rul=real] :: effective permission
|
||||
@ -861,6 +863,7 @@
|
||||
$% [%& p=suba] :: delta
|
||||
[%| p=@tas] :: label
|
||||
== ::
|
||||
+$ norm (axal ?) :: tombstone policy
|
||||
+$ open $-(path vase) :: get prelude
|
||||
+$ page (cask *) :: untyped cage
|
||||
+$ plop blub :: unvalidated blob
|
||||
|
@ -177,9 +177,6 @@
|
||||
bar=(set plop) :: new content
|
||||
== ::
|
||||
::
|
||||
:: Tombstone policy
|
||||
::
|
||||
+$ norm (axal ?)
|
||||
::
|
||||
:: Formal vane state.
|
||||
::
|
||||
@ -1466,6 +1463,11 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
++ set-norm
|
||||
|= =norm
|
||||
=. nor.dom norm
|
||||
..park
|
||||
::
|
||||
:: Attach label to aeon
|
||||
::
|
||||
++ label
|
||||
@ -5259,6 +5261,13 @@
|
||||
`..^^$
|
||||
=. ..^^$ (tomb-lobe lobe.i.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
|
||||
::
|
||||
@ -5318,45 +5327,10 @@
|
||||
..^$
|
||||
((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
|
||||
|= =dome
|
||||
^- (set [norm yaki])
|
||||
=| =aeon
|
||||
=/ =aeon 1
|
||||
|- ^- (set [norm yaki])
|
||||
?: (lth let.dome aeon)
|
||||
~
|
||||
@ -5376,17 +5350,67 @@
|
||||
(~(uni in $(p.yaki t.p.yaki)) ^$(tako i.p.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
|
||||
|= [=norm =yaki]
|
||||
^- (map lobe blob)
|
||||
=/ lobes=(list [=path =lobe]) ~(tap by q.yaki)
|
||||
|- ^- (map ^lobe blob)
|
||||
?~ lobes
|
||||
~
|
||||
%+ uni-blobs $(lobes t.lobes)
|
||||
?: =([~ %&] +:(~(fit ^de norm) path.i.lobes))
|
||||
(pick-lobe lobe.i.lobes)
|
||||
[[lobe.i.lobes %dead lobe.i.lobes ~] ~ ~]
|
||||
^+ ..pick-raft
|
||||
|- ^+ ..pick-raft
|
||||
?~ q.yaki
|
||||
..pick-raft
|
||||
?: (~(has in sen) q.yaki)
|
||||
..pick-raft
|
||||
=. sen (~(put in sen) q.yaki)
|
||||
=/ bob (~(get by lat) q.n.q.yaki)
|
||||
=? 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
|
||||
|= =lobe
|
||||
|
Loading…
Reference in New Issue
Block a user