• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Performance issues with javascript

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have few questions regarding performance issues with javascript:

if a jsp code contains lots of javascript methods which are not in use is that a performance issue?

what is better in terms of performance writing code in .js file and loading the file or writing code in the .jsp file itself.

what is heavy in terms of performance a div or a table or a p tag.

what other areas can/should be considered for javascript performance tuning
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Putting the js into a seperate file is normally better since it gets cached.

You probably would want to look into this: http://dean.edwards.name/packer/

===

Tables render slower than divs/spans. Plenty on information out there with the a google search.


===

Some performance tips

http://blogs.msdn.com/ie/archive/2006/08/28/728654.aspx

Eric
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if a jsp code contains lots of javascript methods which are not in use is that a performance issue?


There is a tiny performance hit, but in all likelihood it's much too small to be worth contemplating.

what is better in terms of performance writing code in .js file and loading the file or writing code in the .jsp file itself.


If you have it as part of the page it gets generated and sent every time the page is accessed. On the other hand, if you keep it in a separate file you save that effort on the server, because the browser will cache it as long as it's unchanged - much better.
[ February 05, 2008: Message edited by: Ulf Dittmer ]
 
sushil bharwani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I appreciate your suggestion,

But a question to eric, you have provided a link to Dean Edwards Packer;

What this does primarly is it removes whitespaces and change the names of variables to a smaller/shorter name does this helps performance ... ?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It shrinks the js file size which means it is a quicker download.

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic