Problem with javascript on an onLoad event

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Shon
Profound User
Posts: 27
Joined: Wed Dec 14, 2011 12:25 pm
First Name: Shon
Last Name: Malone
Company Name: Summit
Phone: (863) 668-7657
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33801
Country: United States
Contact:

Problem with javascript on an onLoad event

Post by Shon »

I have been using an onLoad event to change the number of rows in my grid, and to move some totals following the grid up to match the newly shortened grid. My users are complaining of long wait times between button presses, and screen refreshes. I checked in Debug and it turns out that the program is running very fast and that the long load time occurs between the EXFMT and the screen render. I figured the issue is due to the onLoad events, so I was trying to limit them to only run the first time. Either I have gotten the javascript syntax wrong or something else is amiss, because it isn't working. I can assure you that the variable LoadCount is 1 at time of EXFMT. Could somebody offer me some advice/help? It would be greatly appreciated. Here is my onLoad javascript:
if (get("LOADCOUNT")==1) {getObj("Grid1").grid.setNumberOfRows(get("SFLSIZE")); pui.shiftElements(1800,2800,parseInt(get("OFFSET"),10))};
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Problem with javascript on an onLoad event

Post by Scott Klement »

I'm finding it hard to believe that this JavaScript is causing any significant delays during the screen load time. Are you use this is the culprit? If you remove the code, does the performance problem go away?
Shon
Profound User
Posts: 27
Joined: Wed Dec 14, 2011 12:25 pm
First Name: Shon
Last Name: Malone
Company Name: Summit
Phone: (863) 668-7657
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33801
Country: United States
Contact:

Re: Problem with javascript on an onLoad event

Post by Shon »

You are right, I removed the javascript, and the screen render is still slow at about 4-5 seconds. So what should I look at next on why the render is slow?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Problem with javascript on an onLoad event

Post by Scott Klement »

Does the extra wait time occur while the "little wait circle" is spinning? Or after it has stopped?

Is it slow in all browsers?

Is it only slow when you first open the browser? Or is it fast when you first open the browser, but get slower over time?

Have you tried using something like Firebug to look at the load times and see how much time is spent on each task?
Shon
Profound User
Posts: 27
Joined: Wed Dec 14, 2011 12:25 pm
First Name: Shon
Last Name: Malone
Company Name: Summit
Phone: (863) 668-7657
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33801
Country: United States
Contact:

Re: Problem with javascript on an onLoad event

Post by Shon »

I tried it in Firefox. It seems to be 3 times faster in Firefox, but we aren't allowed to use a good browser here, we are stuck with IE. Firebug showed me the load times. It doesn't seem to be any faster or slower from the first load to each returning load, but rather the times change between each cycle through. There are 7 post for each cycle. The first post for the whole page seems to be the longest, ranging from 45-900 ms. The other 6 posts are for the Option values on 6 different drop down boxes on the screen. The times from those range from 49-470, even though they all have the same value of: {success:true,response:[new Option("HEALTH INSURANCE","HI"),new Option("RENT/HOUSING","RH")]}

I am not sure what else to try to speed things up. I wish using Firefox was an option, but apparantly we need to use the "most popular" browser among our customers, which is the default browser for their operating systems. Any more advice would be greatly appreciated.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Problem with javascript on an onLoad event

Post by Scott Klement »

What I'm looking for is what you see when you mouse over something that's peforming badly on the "Net" tab in firebug.

For example:
3-5-2013 4-13-20 PM.png
3-5-2013 4-13-20 PM.png (90.38 KiB) Viewed 3679 times
In this case, I'm viewing a page that does not have performance problems, but... you'll see that the particular item I moused-over spent 550ms blocking, and 165ms waiting for the server. That tells me that it spent no time on DNS, connecting, sending or receiving...

So what I'm looking for is a starting point into understanding what is causing it to be slow.
Shon
Profound User
Posts: 27
Joined: Wed Dec 14, 2011 12:25 pm
First Name: Shon
Last Name: Malone
Company Name: Summit
Phone: (863) 668-7657
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33801
Country: United States
Contact:

Re: Problem with javascript on an onLoad event

Post by Shon »

Ok. So I have an initial load here, followed by a subsequent load. The POST12325 shows the beginning for each. I have shown the Responses for a few of the 6 selection box criteria that seems to happen each time the screen redisplays.
[img]Capture03062013.PNG[/img]
Attachments
Screen cap
Screen cap
Capture03062013.PNG (105.84 KiB) Viewed 3671 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Problem with javascript on an onLoad event

Post by Scott Klement »

The speeds you show here seems quite respectable. I can only guess that the problem is occurring in the browser.

Maybe you have the infamous Internet Explorer memory leak? If so, you might try setting up a refresh interval:
http://www.profoundlogic.com/docs/displ ... h+Interval
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Problem with javascript on an onLoad event

Post by Scott Klement »

the PUI0009103 program is the one that runs an SQL statement to fill a drop-down list. So, that should be fast -- and we'll see it run for every drop-down on your page.

But, I'm surprised to not see PUI0001200, which is the main PUI session.

Having said that, I stand by what I said earlier. If you're seeing a performance improvement using Firefox vs. IE, then most likely you've got a problem with IE's memory leak. So give the refresh interval a try.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests