Skip to content

fix(#991): optimize atom-in-atom XSL with xsl:key - #1041

Open
ImilB wants to merge 1 commit into
objectionary:masterfrom
ImilB:issue-991
Open

fix(#991): optimize atom-in-atom XSL with xsl:key#1041
ImilB wants to merge 1 commit into
objectionary:masterfrom
ImilB:issue-991

Conversation

@ImilB

@ImilB ImilB commented Jul 14, 2026

Copy link
Copy Markdown

Closes #991.

Problem

The atom-in-atom XSL transformation exceeds 100ms threshold on large XMIR files (~120ms).

Root Cause

The selector //o[eo:atom(.) and o[eo:atom(.)]] calls eo:atom(.) on every <o> element in the document and then again on each of their children. eo:atom(.) = exists($o/o[@name=$eo:lambda]) performs a child element lookup each time. The effective cost is O(n × degree), which on large XMIR files with many objects and children exceeds the threshold.

Solution

Added xsl:key for fast lookup of atoms and replaced the expensive function calls.

Signed-off-by: ImilB <kiwiyt09a@gmail.com>

@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 Thank you for the contribution! But these changes require some sort of a test. It would be nice to have some proof that these changes are actually improving performance

@ImilB

ImilB commented Jul 22, 2026

Copy link
Copy Markdown
Author

@volodya-lombrozo Thank you for the review!

I've added performance test results:

Performance Improvement

Metric Before After Improvement
Time 120ms 45ms 75ms (62.5%)
Status ❌ Over threshold ✅ Under threshold -

How to reproduce

Run the lints against eo-runtime:

mvn clean install -Pqulice --errors -Dstyle.color=never
Before
[WARNING] XSL transformation 'atom-in-atom' took 120ms, whereas threshold is 100ms
After
[INFO] XSL transformation 'atom-in-atom' took 45ms, whereas threshold is 100ms

The optimization works as expected.
<img width="2137" height="1192" alt="изображение" src="https://github.com/user-attachments/assets/19617f0d-359d-4bed-a07b-42258f5d51d7" />

@ImilB

ImilB commented Jul 23, 2026

Copy link
Copy Markdown
Author
изображение

@ImilB

ImilB commented Jul 26, 2026

Copy link
Copy Markdown
Author

@yegor256 solved #991

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.

atom-in-atom XSL transformation exceeds 100ms threshold on large XMIR files

2 participants