fine: WIP second list for performance

This commit is contained in:
Ted Blackman 2022-02-14 10:34:26 -06:00
parent 36550f8ea9
commit b2051fcc2b
2 changed files with 41 additions and 53 deletions

View File

@ -964,11 +964,13 @@
== ==
+$ keen-state +$ keen-state
$: wan=(list want) :: request packets $: wan=(list want) :: request packets
nex=(list want) :: request packets, unsent
hav=(list have) :: response packets, backward hav=(list have) :: response packets, backward
num-fragments=@ud num-fragments=@ud
num-received=@ud num-received=@ud
next-wake=(unit @da) next-wake=(unit @da)
listeners=(set duct) listeners=(set duct)
last-sent=(list [@ud @da])
== ==
+$ want +$ want
$: fra=@ud $: fra=@ud

View File

@ -2598,7 +2598,7 @@
== ==
++ ke-core . ++ ke-core .
++ ke-abet ++ ke-abet
:: =. ke-core ke-set-wake =. ke-core ke-set-wake
=/ gone=? =/ gone=?
=, keen =, keen
:: num-fragments is 0 when unknown (i.e. no response :: num-fragments is 0 when unknown (i.e. no response
@ -2648,24 +2648,9 @@
$(marked [want marked]) $(marked [want marked])
=. tries.want +(tries.want) =. tries.want +(tries.want)
=. last-sent.want now =. last-sent.want now
=. ke-core (ke-send hoot.want) =. ke-core (ke-send [fra hoot]:want)
$(marked [want marked]) $(marked [want marked])
:: ::
++ ke-retrieve-req
=| naw=(list want)
=/ og wan.keen
|= fra=@ud
^- [(unit want) (list want)]
?: =(~ wan.keen) `og
=^ =want wan.keen wan.keen
:: ?: (gth fra.want fra)
:: `og
?. =(fra.want fra)
$(naw [want naw])
=. tries.want +(tries.want)
=. last-sent.want now
[`want (welt naw [want wan.keen])]
::
++ ke-start ++ ke-start
~| tried-to-start-request-already-in-progress/path ~| tried-to-start-request-already-in-progress/path
?> =(num-fragments.keen 0) ?> =(num-fragments.keen 0)
@ -2686,53 +2671,49 @@
|= =rawr |= =rawr
^+ ke-core ^+ ke-core
=- ke-core(keen -) =- ke-core(keen -)
%_ keen
num-fragments siz.rawr
:: ::
wan =/ paz=(list want)
%+ turn (gulf 1 siz.rawr) %+ turn (gulf 1 siz.rawr)
|= fra=@ud |= fra=@ud
^- want ^- want
[fra (ke-encode-req fra) now 0 0] [fra (ke-encode-req fra) now 1 0]
::
%_ keen
num-fragments siz.rawr
wan paz
nex paz
== ==
:: +ke-continue: send packets according to normal congestion flow :: +ke-continue: send packets according to normal congestion flow
:: 2,3,4 -> ::
:: 2 <-
:: 3,4,5 ->
:: 3,4,5 ->
++ ke-continue ++ ke-continue
=/ start +(num-received.keen) =| inx=@ud
=/ ceil (sub num-fragments.keen num-received.keen) =/ max num-slots:ke-gauge
=/ len (min ceil num-slots:ke-gauge) |- ^+ ke-core
=/ end (add start len) ?: =(~ nex.keen) ke-core
=/ fra=@ud start ?: =(inx max) ke-core
|- =^ =want nex.keen nex.keen
?: =(fra end) =. ke-core (ke-emit hoot.want)
ke-core $(inx +(inx))
=/ [req=(unit want) new-wants=_wan.keen]
(ke-retrieve-req fra)
?~ req $(fra +(fra))
?. =(tries.u.req 1) $(fra +(fra))
=. wan.keen new-wants
=. ke-core (ke-send hoot.u.req)
$(fra +(fra))
:: ::
++ ke-send ++ ke-send
|= =hoot |= [fra=@ud =hoot]
=. metrics.scry (on-sent:ke-gauge 1) =. metrics.scry (on-sent:ke-gauge 1)
=. nex.keen
=| xen=(list want)
|- ^+ nex.keen
=^ =want nex.keen nex.keen
?: =(fra fra.want)
(welt xen nex.keen)
$(xen [want xen])
(ke-emit hoot)
::
++ ke-emit
|= =hoot
^+ ke-core
=- ke-core(event-core -) =- ke-core(event-core -)
%- emit %- emit
[unix-duct.ames-state %give %send pe-lane `@ux`hoot] [unix-duct.ames-state %give %send pe-lane `@ux`hoot]
:: ::
++ ke-req
|= fra=@ud
=^ req wan.keen
(ke-retrieve-req fra)
?~ req
~& missing/fra
ke-core
(ke-send hoot.u.req)
::
++ ke-decode-full ++ ke-decode-full
=, keen =, keen
~| %frag-mismatch ~| %frag-mismatch
@ -2828,7 +2809,8 @@
=. next-wake.keen next-wake =. next-wake.keen next-wake
(ke-wait u.next-wake) (ke-wait u.next-wake)
ke-core ke-core
:: TODO: almost identical to +on-take-wake :: +ke-take-wake: handle request packet timeout
::
++ ke-take-wake ++ ke-take-wake
^+ ke-core ^+ ke-core
=. pe-core %- pe-update-qos =. pe-core %- pe-update-qos
@ -2845,9 +2827,13 @@
!=(%czar (clan:title ship)) !=(%czar (clan:title ship))
== ==
route.peer(direct.u %.n) route.peer(direct.u %.n)
:: handle timeout ::
=. metrics.scry on-timeout:ke-gauge =. metrics.scry on-timeout:ke-gauge
(ke-req fra:(head wan.keen)) ?> ?=(^ wan.keen)
=: tries.i.wan.keen +(tries.i.wan.keen)
last-sent.i.wan.keen now
==
(ke-send [fra hoot]:i.wan.keen)
-- --
-- --
++ on-keen ++ on-keen