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

Update maybe_xml in compare project to the latest version and add quick-xml borrowed to compare table #691

Merged
merged 3 commits into from
Dec 2, 2023

Conversation

Mingun
Copy link
Collaborator

@Mingun Mingun commented Dec 1, 2023

I found, that at least part of our slowdown against maybe_xml is because we benchmarked in buffered mode, while maybe_xml completely allocation-free. Add the same variant for quick-xml

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (222532c) 65.06% compared to head (82cc0da) 65.06%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #691   +/-   ##
=======================================
  Coverage   65.06%   65.06%           
=======================================
  Files          38       38           
  Lines       17942    17942           
=======================================
  Hits        11674    11674           
  Misses       6268     6268           
Flag Coverage Δ
unittests 65.06% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dralley
Copy link
Collaborator

dralley commented Dec 1, 2023

I found, that at least part of our slowdown against maybe_xml is because we benchmarked in buffered mode, while maybe_xml completely allocation-free. Add the same variant for quick-xml

How much was it reduced, and have you done any profiling?

@Mingun
Copy link
Collaborator Author

Mingun commented Dec 2, 2023

Not much actually. After the change we win in couple tests, but in other we still 1.5x-2x slower that maybe_xml. I did not ran the profiler yet (I need to find the right tool and how to correctly interpret the results, my experience in profiling is almost zero).

I think about two possible reasons:

  • maybe_xml parser consist from const functions so maybe it is greatly optimized by the compiler;
  • maybe_xml performs lazy detection of end of the tag name in start/empty tags (<tag attributes...>). Actually, in the benchmark it never runs the corresponding piece of code. Because tags are significant part of any XML, I think, this could be major cause of slow down.

quick-xml was benchmarked in buffered mode which a bit unfair
@dralley
Copy link
Collaborator

dralley commented Dec 2, 2023

I forget that you use Windows, it's definitely more challenging on Windows than Linux.

If there are any samples you'd like to see profiled I can run them for you. I have a few real-world cases in mind that I could test out.

@Mingun
Copy link
Collaborator Author

Mingun commented Dec 2, 2023

Right now I'm not know from where I should start. I tried to benchmark the new parser and unfortunately it is always 2x slower that current implementation. I expected an improvement or at least the same results. Need to figure out why it so slow, because the new implementation is definitely simpler to understand. It will be great to benchmark and profile the quick_xml::parser::Parser separately to see where the bottleneck. I will try to do that.

@Mingun Mingun merged commit a4b0f53 into tafia:master Dec 2, 2023
6 checks passed
@Mingun Mingun deleted the compare-benches branch December 2, 2023 16:25
@Mingun
Copy link
Collaborator Author

Mingun commented Dec 2, 2023

Well, just checked -- quick_xml::parser::Parser as fast as maybe_xml (only 1-2 µs slower than it, but I never tried to made optimizations) i. e. about 1.5x-2x faster than current quick_xml implementation. So at least I'm on the right path.

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.

3 participants