473,395 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

faster page loading

Soniad
66
Hello,
i am using VBScript to load xml file and creating array of xml child nodes. i am retreiving this xml file from server using "Server.mappath". i think due to this process, my asp page is loading slowly. i want to reduce page load time..any suggestions..

Regards,
"D"
Jan 15 '09 #1
4 2364
Nicodemas
164 Expert 100+
I can't agree that use of Server.MapPath() is the cause of the execution time lag.

Can we see some code?
Jan 15 '09 #2
Soniad
66
ya sure..here's the code :


If trim(session("language")) = "" Then
session("language") = "ENGLISH"
End If
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False 'Download XML file first, then load rest of page (IE only)

xml.load (Server.MapPath("../../language/"&trim(session("language"))&"/Instant.xml"))


For i = 0 TO (xml.documentElement.childNodes.length - 1)
Set thisChild = xml.documentElement.childNodes(i)
English = thisChild.childNodes(2).Text
ReDim Preserve hindiArray(i)
hindiArray(i) = English
next


xml.async = False '//Download XML file first, then load rest of page (IE only)

xml.load (Server.MapPath("../../language/"&trim(session("language"))&"/common.xml"))

For i = 0 TO (xml.documentElement.childNodes.length - 1)
Set thisChild = xml.documentElement.childNodes(i)
English= thisChild.childNodes(2).Text
ReDim Preserve CmhindiArray(i)
CmhindiArray(i) = English
Next


set xml = Nothing



Regards
"D"
Jan 15 '09 #3
Nicodemas
164 Expert 100+
the issue is in your For loop, I believe. My reasons are below, as well as my suggestions:

Change your For loop's counting method. You have this:
Expand|Select|Wrap|Line Numbers
  1. For i = 0 TO (xml.documentElement.childNodes.length - 1) 
  2.  
Everytime the loop cycles back, it has to reevaluate the value of xml.documentElement.childNodes.length - 1. Instead of making the processor do that math over and over again, do the following. It's only one computation:

Expand|Select|Wrap|Line Numbers
  1. dim stopCount
  2. stopCount = xml.documentElement.childNodes.length - 1
  3.  
  4. For i = 0 to stopCount
  5.  

Second, you have a ReDim statement in your loop. That's really processor intensive because it has to reassign the entire memory space of the array each time you ReDim.

I suggest you use a VBScript dictionary instead.
Jan 18 '09 #4
Soniad
66
@Nicodemas

Thank you ...I have modified the code as below ..and its loading time is much better than before..


Expand|Select|Wrap|Line Numbers
  1. stopCount = xml.documentElement.childNodes.length - 1                 
  2. ReDim Preserve hindiArray(stopCount)
  3.  
  4. For i = 0 TO stopCount
  5.     Set thisChild = xml.documentElement.childNodes(i) 
  6.     English = thisChild.childNodes(2).Text 
  7.     'ReDim Preserve hindiArray(i)
  8.     hindiArray(i) = English
  9. next

Regards,
"D"
Jan 18 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BKM | last post by:
I've been using the following 2 ways to make sure my WebBrowser is finished loading a page before continuing with the next code. do:doevents:loop while WebBrowser.Busy do:doevents:loop until...
3
by: Christina Androne | last post by:
Hello! Anybody knows a faster method for adding toolbox items to the IDE toolbox programatically? At the moment I am using the ToolBox.ToolBoxItems.Add (...), but since all the componets I need...
2
by: Boniek | last post by:
Hi I'm writing different applications in ASP.NET and I'm not happy with my application because ASP.NET work a little slowly. I mean that after any actions on the page my page is refreshing and...
7
by: UJ | last post by:
I've got a page with a user control on it. While the page is loading, it needs to check certain conditions of the user object to enable/disable things on the screen. Currently in the page_load of...
1
by: John Smith | last post by:
Hey folks, Got a weird one for you that I think may just be a bug with Internet Explorer. I have a page that hosts an IFrame. When I call Javascript in my page to change the source of the...
25
by: Ganesh | last post by:
Hi, This is a question that pertains to pointers in general (C or C++). Which of the following is faster and why? for (int i = 0; i < N; i++) = ... a... (or)
0
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and...
4
by: Tim | last post by:
Hello, I have a web page that a user enters in information and selects some products. On submit the page the info is saved to a db, connects to third party web apps and retrieves data, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.