LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reduce the execution time of the VI while parsing data from the XML file

Solved!
Go to solution

Hi,

I used to read the set of parameter data from the XML file and update each data’s in the output format of the array of cluster. While parsing the data VI taking time to parse data from the XML file.

I have made the VI based on the output format which I have required further operation.

Anyone can help me in this.

Note : VIs snapshot attached in the message.

0 Kudos
Message 1 of 21
(3,114 Views)

Please attach code and not pictures.

 

If I understand what you are asking, you want us to improve the speed of the XML parsing. Is that correct?

 

Using XPath is slow, very slow. When I needed to parse large XML-files, I switched to a string-based xml parser instead. The one I used then was proprietary but I am sure there are others to find. Your parsing seems pretty simple, so creating some string-parsing should be possible.

Certified LabVIEW Architect
0 Kudos
Message 2 of 21
(3,098 Views)

 Code is attached for your reference 

If I understand what you are asking, you want us to improve the speed of the XML parsing. Is that correct? - Yes, with the same output format

0 Kudos
Message 3 of 21
(3,064 Views)

The XML file would be useful. I didn't see it in the zip nor in the zip in the zip.

 

A replacement solution won't do the exact same thing for every input. It might still work properly for the correct input...

 

You use XPath for everything. But the cluster is hierarchical, and so is the XML file. Presumably, the XML hierarchy is resembling the cluster hierarchy. So, instead of searching with XPath, get the node matching the cluster, than link each XML child to each cluster element. There'd be no need for XPath, and going over child elements of an XML node will be much, much faster.

0 Kudos
Message 4 of 21
(3,023 Views)

Hi Carya,

 

Some reasons could not able to share the XML file  here.

 

dhana03_0-1580133158264.png

Is this one you are talkig about ?.

dhana03_1-1580133175781.png

 

 

Thanks

0 Kudos
Message 5 of 21
(3,008 Views)

@dhana03 wrote:

Some reasons could not able to share the XML file  here.


An edited XML file with the relevant cluster data might help.

 

XML is very versatile. It's hard to advice on the parsing without knowing the structure of the XML, and it's even harder to extract this structure from the code. Still not as hard as extracting it from an image of the code.

 


@dhana03 wrote:

Is this one you are talkig about ?.


Again, hard to tell without a file and the code.

 

Does it work? Is it faster? That are criteria...

0 Kudos
Message 6 of 21
(2,998 Views)

An edited XML file with the relevant cluster data might help:

 XML file attached.

 

Does it work? Is it faster? That are criteria...:

As we expected it's not working.

 

0 Kudos
Message 7 of 21
(2,961 Views)
Solution
Accepted by topic author dhana03

The built-in LabVIEW XML parsing is quite slow.  See here, though the article is from 2013 I tried a while back and I still had a lot of slowdown when I tried using the built-in parser as well.  

 

There's another post here that does speed trials on XML reading, showing that LabVIEW's XML reader slows down exponentially with the size of the file.  If you increase the number of elements in XML from 20 to 210, you'd expect the execution time to go up by a factor of 10 to 11, but in the experiment it goes up by a factor of 76.

 

Solution is unfortunately to rewrite all your code using a different XML library.

0 Kudos
Message 8 of 21
(2,942 Views)

Hi Kyle97330

 

Kyle97330Solution is unfortunately to rewrite all your code using a different XML library:

Thanks for your suggestion. It would be helpful if any sample code in which I can run my XML file to get the same output format so that I can explore it from that.

 

0 Kudos
Message 9 of 21
(2,834 Views)

Have look here.  Using one of the libraries there, I reduced the parsing time by orders of magnitude.  (~340x faster!)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 10 of 21
(2,651 Views)