Speed up +put:by-schematic

This speeds up the +gather step in Ford. By not doing a full sort every
time we add a build, we remove ~30ms of latency from each chat message
sent my landscape.
This commit is contained in:
Elliot Glaysher 2018-12-11 15:52:35 -08:00
parent 5cb536ed37
commit 20ea6e622c

View File

@ -788,9 +788,15 @@
%+ ~(put by builds) schematic.build %+ ~(put by builds) schematic.build
:: ::
=/ dates (fall (~(get by builds) schematic.build) ~) =/ dates (fall (~(get by builds) schematic.build) ~)
?^ (find [date.build]~ dates) |-
^+ dates
?~ dates
[date.build ~]
?: =(i.dates date.build)
dates dates
(sort [date.build dates] gte) ?: (gth date.build i.dates)
[date.build dates]
[i.dates $(dates t.dates)]
:: +del: remove a +build from :builds :: +del: remove a +build from :builds
:: ::
:: Removes :build from :builds by replacing the value at :: Removes :build from :builds by replacing the value at