Skip to content

fix(#992): optimize rt-without-atoms XSL with xsl:key - #1090

Closed
ImilB wants to merge 4 commits into
objectionary:masterfrom
ImilB:issue-992
Closed

fix(#992): optimize rt-without-atoms XSL with xsl:key#1090
ImilB wants to merge 4 commits into
objectionary:masterfrom
ImilB:issue-992

Conversation

@ImilB

@ImilB ImilB commented Jul 23, 2026

Copy link
Copy Markdown

Closes #992.
Problem

The rt-without-atoms XSL transformation exceeds 100ms threshold on large XMIR files (~128-129ms).
Root Cause

The check not(//o[eo:atom(.)]) scans the entire document when no atom is found.
eo:atom(.) = exists($o/o[@name=$eo:lambda]) performs a child lookup per element.
When the XMIR file has no atoms, every element is visited, making the cost O(n × degree).
Solution

Added xsl:key for fast lookup of atoms.

@ImilB

ImilB commented Jul 23, 2026

Copy link
Copy Markdown
Author

@volodya-lombrozo Here is the proof that the optimization works:

Local XSLT performance test

Test environment:

  • Saxon HE 12.10
  • Java 17.0.19
  • Windows 11

Result:
изображение

@ImilB

ImilB commented Jul 26, 2026

Copy link
Copy Markdown
Author

@yegor256 solved #992

@volodya-lombrozo

Copy link
Copy Markdown
Member

/benchmark

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ The /benchmark run failed. See the failed workflow run for details.

@volodya-lombrozo volodya-lombrozo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ImilB Could you rebase your changes on master, please? I will be able to run benchmarks on you changes then.

<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/defect-context.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:key name="atoms" match="o" use="exists(o[@name='lambda'])"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ImilB Can we use eo:atom function here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely. Thanks for pointing that out. I replaced xsl:key with eo:atom(.) here and rebased the branch on master.

ImilB added 4 commits July 29, 2026 14:34
Signed-off-by: ImilB <kiwiyt09a@gmail.com>
Signed-off-by: ImilB <kiwiyt09a@gmail.com>
Signed-off-by: ImilB <kiwiyt09a@gmail.com>
Signed-off-by: ImilB <kiwiyt09a@gmail.com>
@volodya-lombrozo

Copy link
Copy Markdown
Member

Thanks for the contribution! Unfortunately I can't merge this as-is - none of the 4 commits are signed, and our release tooling (Rultor) rejects unsigned commits regardless of CI status. Could you sign your commits and reopen? Here's GitHub's guide on setting that up: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

ImilB added a commit to ImilB/lints that referenced this pull request Jul 30, 2026
@ImilB

ImilB commented Jul 30, 2026

Copy link
Copy Markdown
Author

@volodya-lombrozo I added commit signing, recreated the branch with a signed commit, and reopened the PR. GitHub now shows the commit as Verified.

@0crat

0crat commented Jul 31, 2026

Copy link
Copy Markdown

@volodya-lombrozo Thanks for the review! You've earned +4 points for this: +12 as a basis; -5 for very few (1) comments; -4 for too few (6) hits-of-code; +1 to give you at least something. Your running score is +456; don't forget to check your Zerocracy account too).

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.

rt-without-atoms XSL transformation performance issue with large XMIR files

3 participants