This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Performance issue? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Performance issue?" Watch "Performance issue?" New topic
Author

Performance issue?

Santana Iyer
Ranch Hand

Joined: Jun 13, 2005
Posts: 335
Hi,

I have jsp page where I display records (records come from file so number of records per page can be anywhere from 1 to 10000).

I am providing checkbox with every record ( name as chk1 ... chk1000). With Select All option at top.

On click of select all I call function in javascript.



It takes 5 seconds with 1000 records.

Is there any better/faster way. Because requirement is that there can be 10000 records too.
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by Santana Iyer:

It takes 5 seconds with 1000 records.
requirement is that there can be 10000 records too.


Why you want to display these many records in a single page?
Whats wrong if you do pagination?


My blood is tested +ve for Java.
Santana Iyer
Ranch Hand

Joined: Jun 13, 2005
Posts: 335
Valid point even I raised same question to my senior, but he wants it like that as it is in requirements by client.

Actually number of total records are 1 million or so ......
[ September 26, 2006: Message edited by: Santana Iyer ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It is going to be slow, JavaScript is not good at looping large things with processing. SOme browsers may choke.

Eric
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
When you click on Select All button, set hidden parameter (selectAll = true) and submit the form(without turning on all check boxes to checked).

In request handler, first check the value if request.getParameter("selectaAll") and process further.

I believe your browser is taking time to make all checkboxes checked. By doing above you are eliminating it.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
could also try selecting multiples of check boxes with larger steps. (AKA) hard code 5, step by 5.

Than a small loop to get the ones outside a step of 5.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Performance issue?
 
Similar Threads
Target Unreachable, 'null' returned null
html checkbox tag and checkall javascript functionality results in undefined alert
Select All and Clear All implementation in JSF
Anchor tag calling Javascript function
use jsp in javascript