Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML#xpath(String) is Extremely Slow on Large Files #289

Closed
volodya-lombrozo opened this issue Jan 9, 2025 · 5 comments
Closed

XML#xpath(String) is Extremely Slow on Large Files #289

volodya-lombrozo opened this issue Jan 9, 2025 · 5 comments

Comments

@volodya-lombrozo
Copy link
Contributor

I have a large XML file and run the following java code on it:

private static String findName(final XML program) {
   return program.xpath("/program/@name").stream().findFirst().orElse("unknown");
}

It runs extremely long (minutes). Could you speed up this method, please?

Here is my XML:
Pointer.xmir.txt

XML is instance of XMLDocument.

@volodya-lombrozo
Copy link
Contributor Author

@yegor256 Could you have a look, please?

@volodya-lombrozo
Copy link
Contributor Author

Profiling proofs:
flamegraph-disassemble-44918 copy.html.txt

@yegor256
Copy link
Member

yegor256 commented Jan 9, 2025

@volodya-lombrozo why do you think it may be faster?

@volodya-lombrozo
Copy link
Contributor Author

volodya-lombrozo commented Jan 9, 2025

@yegor256 I showed it here: objectionary/lints#210

@yegor256
Copy link
Member

@volodya-lombrozo xpath() is using nodes() under the hood, that's why I believe this ticket is a duplicate of #288

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

No branches or pull requests

2 participants