question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xml2json extremely slow

See original GitHub issue

Summary

When trying to convert some XMLs to pyhf JSON, I found that the runtime was unacceptably slow (order of hours).

OS / Environment

NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux-logo

Steps to Reproduce

The XMLs are ATLAS internal, but I’m happy to share them with ATLAS members of the dev team on request.

File Upload (optional)

No response

Expected Results

I was hoping it would finish relatively fast.

Actual Results

It took hours.

pyhf Version

pyhf, version 0.6.3
uproot 4.2.2

Code of Conduct

  • I agree to follow the Code of Conduct

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
matthewfeickertcommented, Sep 22, 2022

A final note on this, as I write up the release notes in PR #1705:

$ ls
hww-xml
$ time pyhf xml2json \
    --hide-progress \
    --mount $PWD:/home/cburgard/Physics/statistics/pyfittools/ \
    --output-file workspace.json \
    hww-xml/HWWRun2GGF.xml
pyhf xml2json --hide-progress --mount  --output-file workspace.json   14.71s user 2.33s system 119% cpu 14.269 total

👍 Great work by @kratsg! 🚀

1reaction
kratsgcommented, Jul 1, 2022

PrintXML allows using relative paths too. The downside of using relative paths there is that you (currently) need to call pyhf xml2json from the same place where the relative paths originate from, which is not necessarily the place where the top-level xml is located.

This will be better with #1909 but you can already use --basedir to change the base of the relative paths, by prefixing them, so it doesn’t necessarily need to be in the same place.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why xml to json conversion is so slow? - Stack Overflow
I'm currently trying to improve the performances of my website but the XML2JSON lib I'm using is slowing the process and blocking the ......
Read more >
toXml is very slow when json is large · Issue #61 - GitHub
We have a 200 * 500 cells excel (all data is present as xml in xlsx) work sheet. It takes 200 ms to...
Read more >
XML to JSON policy runtime error troubleshooting | Apigee Edge
This error occurs if the message or string variable specified in the <Source> element of the XML to JSON policy is either:.
Read more >
How to Convert JSON to XML or XML to JSON in C# - Code ...
Demonstrate how to convert JSON to XML back and forth using System.Text.Json and Newtonsoft.Json with detail explanation and examples.
Read more >
Convert XML to JSON with JavaScript - David Walsh Blog
Due to the number of iterations, it would cause the overall parsing be extremely slow. David– Thank you for providing this function. Would...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found