473,624 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

faster page loading

Soniad
66 New Member
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 2380
Nicodemas
164 Recognized Expert New Member
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 New Member
ya sure..here's the code :


If trim(session("l anguage")) = "" Then
session("langua ge") = "ENGLISH"
End If
Dim xml
Set xml = Server.CreateOb ject("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.documentEl ement.childNode s.length - 1)
Set thisChild = xml.documentEle ment.childNodes (i)
English = thisChild.child Nodes(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.documentEl ement.childNode s.length - 1)
Set thisChild = xml.documentEle ment.childNodes (i)
English= thisChild.child Nodes(2).Text
ReDim Preserve CmhindiArray(i)
CmhindiArray(i) = English
Next


set xml = Nothing



Regards
"D"
Jan 15 '09 #3
Nicodemas
164 Recognized Expert New Member
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.documentEle ment.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 New Member
@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
21295
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 WebBrowser.ReadyState = STATE_COMPLETE (or something like that. I don't have the code in front of me) But, for some reason, occasionally the code continues past the loops even
3
1236
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 to add are in the same DLL, I would like to know if there is a way of adding all controls from assembly in one step, without loading , freeing the dll for every added item. SOmethign like AddAllItems(string DllPath). Is there such thing?
2
1367
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 all data from SQL is loading. Generally I have one question. What language I can use to programming standard actions on my page. I think now about JScript. What JScript can do and if it's enough good to work on client machine. I don't think...
7
23335
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 the user control I do things like read from the database on the first load, set some internal variables, ... If I need those things to be available to me on the page load, should I do them on page_init? Are there any ramifications of using...
1
2142
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 IFrame, the blue bar in Internet Explorer starts moving as if it's loading. The problem is, the blue bar never finishes even after the page has completed loading. And yes, I am 110% certain the page has completed loading (including all js stuff). ...
25
1708
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
2195
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 incurred a network hit per image file. i wanted to avoid the overhead of a separate network connection for each image file, so i bundled all the images into the JAR file. yet, somehow, the loading time for the applet is slower now! i'm totally...
4
1286
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 third party data is saved. I want to be able on submit is redirect the user to a loading page (status) while the app is doing the above functionality and then when finished user is redirect to a new page (results). I really do not know where to...
0
8249
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8179
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8633
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4187
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.