fine: use progressive insertion sort instead of quicksort to assemble fragments

This commit is contained in:
Philip Monk 2023-06-14 21:46:25 -07:00
parent a30cb42038
commit f68f3dc833

View File

@ -288,8 +288,7 @@
^- [sig=@ux dat=$@(~ (cask))] ^- [sig=@ux dat=$@(~ (cask))]
=/ mes=@ =/ mes=@
%+ rep response-size %+ rep response-size
%+ turn %+ turn (flop hav)
(sort hav |=([a=have b=have] (lth fra.a fra.b)))
|=(=have dat.have) |=(=have dat.have)
=+ sig=(end 9 mes) =+ sig=(end 9 mes)
:- sig :- sig
@ -4266,9 +4265,16 @@
=^ found=? fine (fi-on-ack num) =^ found=? fine (fi-on-ack num)
?. found ?. found
(fi-fast-retransmit:og num) (fi-fast-retransmit:og num)
=: hav.keen [[num meow] hav.keen] =. num-received.keen +(num-received.keen)
num-received.keen +(num-received.keen) =. hav.keen
== :: insert in reverse order
::
|- ^- (list have)
?~ hav.keen
[num meow]~
?: (lth num fra.i.hav.keen)
[i.hav.keen $(hav.keen t.hav.keen)]
[[num meow] hav.keen]
?. =(num-fragments num-received):keen ?. =(num-fragments num-received):keen
fi-continue fi-continue
(fi-done [sig dat]:fi-sift-full) (fi-done [sig dat]:fi-sift-full)