mirror of
https://github.com/urbit/ares.git
synced 2024-11-22 15:08:54 +03:00
print out memo hits/misses
This commit is contained in:
parent
a5302f3b8b
commit
4bbb786861
@ -1,3 +1,3 @@
|
|||||||
/+ subject-knowledge
|
/+ subject-knowledge
|
||||||
|= [s=sock:subject-knowledge f=*]
|
|= [s=sock:subject-knowledge f=*]
|
||||||
(pull:subject-knowledge bord:subject-knowledge s f)
|
-:(pull:subject-knowledge bord:subject-knowledge s f)
|
||||||
|
@ -386,21 +386,26 @@
|
|||||||
|= [s=sock f=sock]
|
|= [s=sock f=sock]
|
||||||
^- [coot _memo]
|
^- [coot _memo]
|
||||||
?. ?= [%know *] f
|
?. ?= [%know *] f
|
||||||
|
~& "Dyn: {<s>}"
|
||||||
[[%dyn s] memo]
|
[[%dyn s] memo]
|
||||||
=/ jet (juke jute s k.f)
|
=/ jet (juke jute s k.f)
|
||||||
?. ?= ~ jet
|
?. ?= ~ jet
|
||||||
:: found a jet
|
:: found a jet
|
||||||
|
~& "Jet: {<+.u.jet>}"
|
||||||
[[%jet +.u.jet] memo]
|
[[%jet +.u.jet] memo]
|
||||||
=/ mem (~(get by memo) [s k.f])
|
=/ mem (~(get by memo) [s k.f])
|
||||||
?~ mem
|
?~ mem
|
||||||
:: memo miss
|
:: memo miss
|
||||||
=. memo (~(put by memo) [s k.f] `(unit sock)`~) :: blackhole for recursive eval
|
=. memo (~(put by memo) [s k.f] `(unit sock)`~) :: blackhole for recursive eval
|
||||||
=^ res memo ^$(s s, f k.f)
|
=^ res memo ^$(s s, f k.f)
|
||||||
|
~& "Miss: {<[s k.f]>}"
|
||||||
[[%mis res] (~(put by memo) [s k.f] `(unit sock)``r.res)] :: fill in result
|
[[%mis res] (~(put by memo) [s k.f] `(unit sock)``r.res)] :: fill in result
|
||||||
?~ u.mem
|
?~ u.mem
|
||||||
:: memo blackhole
|
:: memo blackhole
|
||||||
|
~& "Recur: {<[s k.f]>}"
|
||||||
[[%rec s k.f] memo]
|
[[%rec s k.f] memo]
|
||||||
:: memo hit
|
:: memo hit
|
||||||
|
~& "Hit: {<[s k.f]>}"
|
||||||
[[%hit u.u.mem] memo]
|
[[%hit u.u.mem] memo]
|
||||||
?+ f ~| %pull-bonk !!
|
?+ f ~| %pull-bonk !!
|
||||||
::
|
::
|
||||||
|
Loading…
Reference in New Issue
Block a user