Parsing takes too long - How to speed-up???
-
I have 18000 items and it takes about 10 minutes to parse my xml-file, but only a few seconds if I comment out line 6. What I'm doing wrong? How can speed-up the following? 1. Set oXMLNodeList = oXMLElement.selectNodes("data/item") 2. Put #fTestFile, , "Count: " & oXMLNodeList.Length & vbCrLf 3. For Each oItemY In oXMLNodeList 4. Put #fTestFile, , vbCrLf 5. For Each oItemX In oItemY.childNodes 6. Put #fTestFile, , " ;" & oItemX.nodeTypedValue 7. Next oItemY 8. Next oItemY
-
I have 18000 items and it takes about 10 minutes to parse my xml-file, but only a few seconds if I comment out line 6. What I'm doing wrong? How can speed-up the following? 1. Set oXMLNodeList = oXMLElement.selectNodes("data/item") 2. Put #fTestFile, , "Count: " & oXMLNodeList.Length & vbCrLf 3. For Each oItemY In oXMLNodeList 4. Put #fTestFile, , vbCrLf 5. For Each oItemX In oItemY.childNodes 6. Put #fTestFile, , " ;" & oItemX.nodeTypedValue 7. Next oItemY 8. Next oItemY
I do not work with VB so this is somewhat of an outside observation and could be a worthless comment but: I would have added a line 4.5 Set oYList = oItemY.childNodes assuming this is valid in VB. Potentially you may be copying the data over and over, I have seen this impact. Then line 5 would be For Each oItemX in OYList Line 7 should be Next oItemX by commenting out line 6 you are never actually addressing the data. Good ideas are not adopted automatically. They must be driven into practice with courageous patients. -Admiral Rickover. ...