Skip to content

Conversation

@Fang-
Copy link
Collaborator

@Fang- Fang- commented Dec 18, 2025

d5af20f rewrites +inde (indentation block parser, used for multi-line strings). Previously, +inde would reparse all contiguous parts of the input that had the same (or deeper) indentation level, even after the block's closing.

Here, we make it take the opening and closing parse rules as explicit arguments, automatically include the leading and trailing newlines in the implementation, and reparse only up to the block's closing.

Parsing hoon.hoon becomes negligibly faster.

Parsing a degenerate version of hoon.hoon, where the first arm is a ''' block-cord without any indentation, becomes ~25% faster.

Parsing /lib/language-server/rune-snippet, which contains many """ block-tapes at the same indentation level, becomes ~45% faster.

This also turns +iny, whose implementation was a one-to-one copy of +inde, into an alias for +inde.


d9c3d7b wraps the parsers in +rope's pose (the wing parsers) inside a +stew instead. Nearly all of its different cases are distinguishable by its first character, making it a good candidate for this.

This improves the performance of parsing hoon.hoon by ~10%.


No tests specifically for the multi-line string parsing, but did catch (and patch) some accidental breakage when building tests and other files. I expect it to have parity.

Previously, +inde would reparse all contiguous parts of the input that
had the same (or deeper) indentation level, even after the block's
closing.

Here, we make it take the opening and closing parse rules as explicit
arguments, automatically include the leading and trailing newlines in
the implementation, and reparse only up to the block's closing.

Parsing hoon.hoon becomes ~2% faster. Negligible.

Parsing a degenerate version of hoon.hoon, where the first arm is a
`'''` block-cord without any indentation, becomes ~25% faster.

Parsing /lib/language-server/rune-snippet, which contains many `"""`
block-tapes, becomes ~45% faster.

This also turns +iny, whose implementation was a one-to-one copy of
+inde, into an alias for +inde.
Nearly all of the different cases in +rope are distinguishable by their
first character, making it a good candidate for +stew.

This change improves the performance of parsing hoon.hoon by ~10%.
@Fang- Fang- requested review from frodwith, joemfb and pkova December 18, 2025 21:56
@Fang- Fang- added the hoon label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants