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))]
=/ mes=@
%+ rep response-size
%+ turn
(sort hav |=([a=have b=have] (lth fra.a fra.b)))
%+ turn (flop hav)
|=(=have dat.have)
=+ sig=(end 9 mes)
:- sig
@ -4266,9 +4265,16 @@
=^ found=? fine (fi-on-ack num)
?. found
(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
fi-continue
(fi-done [sig dat]:fi-sift-full)