Skip to content

jets: faster gas - #1030

Merged
dozreg-toplud merged 6 commits into
developfrom
dozreg/faster-gas
Jul 20, 2026
Merged

jets: faster gas#1030
dozreg-toplud merged 6 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
@dozreg-toplud
dozreg-toplud merged commit 29c276a into develop Jul 20, 2026
2 checks passed
@dozreg-toplud
dozreg-toplud deleted the dozreg/faster-gas branch July 20, 2026 19:42
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.

2 participants