graph-push-hook: add better hints for profiling

This commit is contained in:
Logan Allen 2021-05-06 16:29:59 -05:00
parent 9b4b9c5c72
commit 57f5550dbc
2 changed files with 43 additions and 14 deletions

View File

@ -33,6 +33,7 @@
%- (agent:push-hook config)
^- agent
=-
~% %graph-push-hook-agent ..scry.hook-core ~
=| state-one
=* state -
|_ =bowl:gall
@ -72,6 +73,7 @@
::
++ on-fail on-fail:def
++ transform-proxy-update
~/ %transform-proxy-update
|= vas=vase
^- (unit vase)
=/ =update:store !<(update:store vas)
@ -81,9 +83,16 @@
%add-nodes
?. (is-allowed-add:hc rid nodes.q.update)
~
:: TODO: this scry is slow.
=/ mark (get-mark:gra rid)
?~ mark `vas
|^
=< $
~% %transform-add-nodes ..transform-proxy-update ~
|%
++ $
^- (unit vase)
:: TODO: scries are slow, we should find a way to cache this so as
:: not to need to fetch it continually in the hot path
=/ transform
!< $-([index:store post:store atom ?] [index:store post:store])
%. !>(*indexed-post:store)
@ -98,6 +107,7 @@
[~ !>(update)]
::
++ flatten-node-map
~/ %flatten-node-map
|= lis=(list [index:store node:store])
^- (list [index:store node:store])
|^
@ -129,6 +139,7 @@
--
::
++ transform-list
~/ %transform-list
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|= $: [=index:store =node:store]
[indices=(set index:store) lis=(list [index:store node:store])]
@ -172,6 +183,7 @@
++ resource-for-update resource-for-update:gra
::
++ initial-watch
~/ %initial-watch
|= [=path =resource:res]
^- vase
|^
@ -211,7 +223,8 @@
==
--
::
^| ^= hook-core
~% %graph-push-hook-helper ..card.hook-core ~
^= hook-core
|_ =bowl:gall
+* grp ~(. group bowl)
met ~(. mdl bowl)
@ -254,6 +267,8 @@
++ get-roles-writers-variation
|= =resource:res
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
:: TODO: doing three scries in a row on the hot path is slow
::
=/ assoc=(unit association:metadata)
(peek-association:met %graph resource)
?~ assoc ~
@ -276,6 +291,8 @@
++ is-allowed-add
|= [=resource:res nodes=(map index:store node:store)]
^- ?
:: TODO: extremely slow due to scries. This takes about ~30ms per
:: %add-nodes event.
|^
%- (bond |.(%.n))
%+ biff (get-roles-writers-variation resource)
@ -291,6 +308,7 @@
%.n
?. =(author.p.post.node src.bowl)
%.n
:: TODO: these scries are slow, find a way to persistently cache them
=/ =permissions:store
%^ add-mark resource vip
(node-to-indexed-post node)

View File

@ -26,6 +26,7 @@
::
/- *push-hook
/+ default-agent, resource, verb, versioning, agentio
~% %push-hook-top ..part ~
|%
+$ card card:agent:gall
::
@ -84,6 +85,7 @@
%.n
::
++ push-hook
~/ %push-hook
|* =config
$_ ^|
|_ bowl:gall
@ -175,6 +177,7 @@
=* state -
^- agent:gall
=<
~% %push-agent-lib ..poke-hook-action ~
|_ =bowl:gall
+* this .
og ~(. push-hook bowl)
@ -267,6 +270,7 @@
!>(state)
::
++ on-poke
~/ %on-poke
|= [=mark =vase]
^- (quip card:agent:gall agent:gall)
?: =(mark %push-hook-action)
@ -283,6 +287,7 @@
[cards this]
::
++ on-watch
~/ %on-watch
|= =path
^- (quip card:agent:gall agent:gall)
?: ?=([%version ~] path)
@ -320,6 +325,7 @@
--
::
++ on-agent
~/ %on-agent
|= [=wire =sign:agent:gall]
^- (quip card:agent:gall agent:gall)
?. ?=([%helper %push-hook @ *] wire)
@ -373,6 +379,7 @@
[%x %min-version ~] ``version+!>(version.config)
==
--
~% %push-helper-lib ..card ~
|_ =bowl:gall
+* og ~(. push-hook bowl)
ver ~(. versioning [bowl [update-mark version min-version]:config])
@ -380,6 +387,7 @@
pass pass:io
::
++ poke-hook-action
~/ %poke-hook-action
|= =action
^- (quip card:agent:gall _state)
|^
@ -448,6 +456,7 @@
[%pass wire %agent [our.bowl store-name.config] %watch store-path.config]
::
++ push-updates
~/ %push-updates
|= =cage
^- (list card:agent:gall)
%+ roll (resource-for-update q.cage)
@ -484,6 +493,7 @@
--
::
++ forward-update
~/ %forward-update
|= =cage
^- (list card:agent:gall)
=- lis
@ -532,6 +542,7 @@
(slav %ud i.extra)
::
++ resource-for-update
~/ %resource-for-update
|= =vase
^- (list resource)
%~ tap in