optimisation xml handling within vb.net application -


i have snippet , need optimize faster :

dim lst = (from t in docelet.childnodes select id = t.item("id").outerxml).distinct().tolist()        parallel.for(0, lst.count, sub(i)          dim p xmlelement = getelement(lst(i))        dim ls = (from t in docelet.childnodes t.item("id").innertext = p.innertext select t)          parallel.foreach(ls, sub(d)          dim verif_date string = d.item("dad").innertext         sej.id = d.item("id").innertext          end sub)             end sub) 

this isthe xml structure :

<?xml version="1.0" encoding="utf-8"?> <patientdata> <sejour><id></id><dad></dad></sejour>   </patientdata> 

i'm asking how can fix code because takes lot of time ( 50 sec) in case list contains 20000 elements?

outerxml/innertext methods may slow need walk xml tree , build new xml/text elements.

it looks looking matches value of <id> nodes. if such nodes contain single value , not sub-trees use xmlelement.value.

side note: accessing xml multiple threads parallel.for/parallel.foreach not guaranteed work correctly these classes not thread safe.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -