Skip to content

jets: faster gas#1030

Open
dozreg-toplud wants to merge 2 commits into
developfrom
dozreg/faster-gas
Open

jets: faster gas#1030
dozreg-toplud wants to merge 2 commits into
developfrom
dozreg/faster-gas

Conversation

@dozreg-toplud

@dozreg-toplud dozreg-toplud commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

It always felt strange to me that +silt/+malt iterate over the list of elements in a loop, assembling an nlr-tree by putting one element at a time. Doing so may cause arbitrary reshuffling of nodes on every put, since there is no guarantee for the order of insertions relative to +gor/+mor orderings.

This PR adds a fast path for +gas:by/+gas:in if the input tree is empty. The fast path is basically quicksort, where the pivot is chosen by taking a "mor"-most element, and the partions are made with +gor.

Extra attention was payed to +gas:by jet to make sure that for each key only the last key-value pair is taken: order of partitions is preserved, and the last key-value pair is used as a pivot, keys being equal.

Tested by setting ice of jets to c3n, then booting and running the test suite.

When comparing performance I saw ~30% improvement for the fast path.

@dozreg-toplud dozreg-toplud requested a review from joemfb June 10, 2026 20:01
@dozreg-toplud dozreg-toplud requested a review from a team as a code owner June 10, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant