0

I have JSP which takes more than 12 seconds to load. It works fine on IE11. It includes 6 other jsps within. I am trying to analyze what is causing longer load time for parent jsp.

Does included JSPs are compiled every time parent JSP is being loaded?

Each JSP and parent JSP has some functions defined in script tag.
Are these functions compiled on server? And if compiled does browser render this JS functions everytime on load?

Improvement steps: Include all JS functions in JS script and import it on page. So that browser can pick it up from browser cache rather than rendering it again and again. Will it help?

Heres the snapshot of profiler report.

enter image description here

pratikpawar
  • 2,038
  • 2
  • 16
  • 20
  • I resolved the issue for IE8 to bring down the load to 3-4 seconds. Added all JS code from script tag into single JS file and imported it on JSP. Subsequently added setTimeout for number of jquery change events which were suppose to be loaded in background. I am working on using minified version of JS file and including JS at the end and see if it would improve the performance further. – pratikpawar Jun 28 '15 at 09:12

2 Answers2

1

JSPs are typically compiled once by the application server, and the resulting class files re-used between restarts. In Tomcat, they are stored in the work directory.

See Where are compiled JSP Java (*__jsp.java) files?

You can delete the work directory, then monitor the work directory after the server starts up and see how long it takes to compile. It shouldn't be any longer for one browser than another, since compilation happens server side.

I am a little confused because the second part of your answer references JS files. Are you asking about Javascript or Java Server Pages?

Community
  • 1
  • 1
tom
  • 1,331
  • 1
  • 15
  • 28
  • its javascript. I need to know if js functions defined in script tag on jsp are compiled on server side too. If so are they loaded by browser everytime since they are in script tag and not in imported js file. My assumption is browser caches imported js and on subsequent calls of same url fetch it from browser cache rather than rendering the same js code back – pratikpawar Jun 27 '15 at 06:57
1

You may profile using any of the java profiler tools like Yourkit and see where most of the time is spent

JavaHopper
  • 5,567
  • 1
  • 19
  • 27
  • Please find attached snap of profiler report. I'm not able to figure out the exact function causing the delay. It says functions are of user type but they are all core juery calls. – pratikpawar Jun 27 '15 at 09:02
  • Hmm.. As you figured out, it was UI issue, not server side – JavaHopper Jun 28 '15 at 11:36