• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP load time performance if there are lot of JS coding

 
Syednizar Kamal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

is Adding javascript coding inside JSP file will degrade the performance(consider there are 200-300 lines of code for javscript) of the JSP. If so is moving the javscript coding to separate script file and including the script file in JSP will boost peformance? Suggest me other options too.What is the best practice in such case?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Definitely Adding javascript coding inside JSP file will degrade the performance. That is what is you requirement of application. It may be possible some JS need before page load or some need after JSP page load.

So Do just one thing make list Which JS need before page load and need JS after page load. Now JS which need after JSP page load put just before
HTML </body> BODY tag close.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishan Patel wrote:Yes, Definitely Adding javascript coding inside JSP file will degrade the performance.

Poppycock! A few hundred lines of JavaScript is nothing. What matters is what that script does. If it puts the browser into an infinite loop, they yeah, there'll be issues.

But the mere presence of a small amount of script in a JSP will have no measurable effect on performance.

That said, putting the script into a separate script file will allow the script to be cached, and is a good idea. This is especially important in client-intensive applications where the amount of script can be considerably larger than a few hundred lines.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!