File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Which is quicker Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Which is quicker" Watch "Which is quicker" New topic
Author

Which is quicker

Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
Loading JS from an external file or loading it in a <script> tag in the head section of the page?
[ January 21, 2008: Message edited by: Bear Bibeault ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well it depends on what you are doing. Is the extrenal file packed? Are you gzipping things?

The external file will contain the same information only real difference is you need to make another http request to get that information. The external file will get cached so it will be faster on multiple hits. That is where he benefit is.

Eric
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
Well I want to create a dynamic Search Results Page. And the information that is displayed as header information vs being put in the table is based on the criteria the user searches by. Right now there are 7 different combinations for the user to search by. I'm thinking this could get my javascript to be pretty long if I'm trying to write different jQuery code for each example. So I though about packaging it up in an external file and break it all down into classes based on the criteria. Then just call the classes I need.

Sound like a good candidate for external JS file that is gzipped? This would be dom manipulation and jqGrid creation. Basically I will have a couple of divs that I'll ID and then do my changes to them.

I think I've talked myself into doing most of it external.

If you have any thoughts please let me know...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which is quicker
 
Similar Threads
loading multiple applets
static block
WA #1.....word association
How swing follows MVC pattern
Is there an ANT task for loading external DLLs