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