• Post Reply Bookmark Topic Watch Topic
  • New Topic

Whitespace could be performance issue  RSS feed

 
kundan sinha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to know whether whitespace through extra lines or by tabbing could be performance issue in jsp.
Sometimes client ask that page limit should be max upto 30KB.To get through this line in complex pages what possible options?

How you check the size of the generated page?

kundan
 
Peter White
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can pre compile your jsp's before deployment. Great for bug tracking too But otherwise you should be able to find a directory on whatever app server you are using that will include the temporary generated java code.

I can't imagine the white space will be an issue when you see the amount of code generated

Peter
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter:

I think several other people have already told you about our naming policy, so I won't repeat it here; but the "White Hexagon" thing has to go.

kundan:

Peter's talking about the size of the generated Java code, which I think is not what you're worried about; you're worried about the size of the HTML that is generated by running the JSP. The easiest way to do that would just be to deploy the code and hit the JSP's URL with a browser, then right-click on the page and "Save page as..." to save the HTML as a file, and then see how big it is. If you want to automate this, instead of a browser you could write a little program that uses a URLConnection to download the page into a char[] or String and then just check its length.
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi kundan

I really think you have got a good issue here. Go to google.com and look at the html source. You will find that new lines and line breaks are totally not there.

This is a serious problem if a number of developers are working on different jsp's that get included in a single file, which becomes one huge piece of html file.

one thing is using gzip compression could help eliminate this problem.

This is however not such a serious problem than to keep the application up and running!!!
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's probably also possible to install a ServletFilter that removes all unnecessary white space from the generated HTML.
 
kundan sinha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for suggestions.

Earlier I was removing the whitespaces in jsp through ANT task at build time. As javascript is heavly used and I could not remove whitespaces in javascripts so Filter compression would certaily help in some of the pages where page size is problem.
Reducing the size of the page and display time is important. I would have to check what would be the overhead of filter.

kundan
[ September 21, 2006: Message edited by: kundan sinha ]
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe a more effective way of reducing your page size than just worrying about white space is to compress/zip your pages before they go to the browser and have the browser unzip them. If the browser doesn't support this (most do) then you detect that and just send the page as is. Here is an article on it:

http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html?page=1
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!