I will have to call below function multiple times in order to display dynamic data (while displaying a graph). This function will be called like more than 50 times, for displaying a single graph page. Problem is it takes long time to parse xml and display graph page (like more than a minute).
If size of file needs to be taken into consideration. First xml file to be parsed is 140kb. Second xml is 8kb.
May I know where I am going wrong? and how I could improve performance in this scenario. Would appreciate any input.
function map(md, tls) {
//First xml file parsing
var melXmlFile = "xml/Mel.xml"
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", melXmlFile , false);
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/xml');
}
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
.....
//Second xml file parsing
var msXmlFile = "xml/Ms.xml"
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", msXmlFile, false);
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/xml');
}
xmlhttp.send();
xmlMsDoc = xmlhttp.responseXML;
......
}
Or should I be using different parsing style instead of XPath, so that performance is better? Thank you.