Client-side JavaScript vs. Server-side Java - Performance

Posted on 2009-02-11
Last Modified: 2012-05-06
I would like to add up the values in rows coming back from a database in a result set so that I get subtotals and totals in a JSP using Javascript.  Say there were 200 hundred rows with 3 columns needing subtotals and totals, would performance be faster on the client using Javascirpt or would it be faster and more efficient to sum up the values on the server, like Websphere for instance?
Question by:jwright9
    LVL 5

    Accepted Solution


    Server side rendering of the data will always be faster.  Firstly, the server will more than surely be superior in power, and the engine used on the server will have a far faster throughput than javascript.

    Secondly, if you were to use client side scripting to render the data, you are reliant on a number of things, namely that the pc the browser is on is fast enough to render the data without it taking too long, and that the client's browser actually has javascript enabled!  This is especially important if you want to take accessibility into account, as the browser being used might not be sophisticated enough to render javascript.


    LVL 107

    Assisted Solution

    by:Ray Paseur
    Clients can turn off Javascript.  Also, if you want to do Javascript calculations, you must first send the data to the browser.  Depending on the amount of data you must send, this can be a bit time-consuming.  I would go the server route, too.

    Best, ~Ray

    Author Comment

    Thanks to both of you experts!  I will take your counsel.  I have always heard since the beginning of the Web era, do it on the server!

    Author Closing Comment

    Very good help!  I'm glad there are folks like you on EE!
    LVL 107

    Expert Comment

    by:Ray Paseur
    Thanks for the points and for your kind words! ~Ray

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now