473,473 Members | 2,169 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Large script source file

We have a fairly large (1500 line) .js file that contains script that
most of our pages use. My personal opinion is that this is not
easy to maintain, but others are concerned that with the script placed
in separate smaller files the web server will have to process several
other requests for script files, which will impact the performance of
the server. Is that concern well placed? If so, is there some other
way to break up a large script source file to make it easier to
maintain?

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #1
1 1902
"Christopher Benson-Manica" wrote in message
news:d9**********@chessie.cirr.com...
We have a fairly large (1500 line) .js file that contains script that
most of our pages use. My personal opinion is that this is not
easy to maintain, but others are concerned that with the script placed
in separate smaller files the web server will have to process several
other requests for script files, which will impact the performance of
the server. Is that concern well placed? If so, is there some other
way to break up a large script source file to make it easier to
maintain?


A case could be made that fewer http requests is better but that logic
taken too far will degrade maintainability. Other factors that I consider
when organizing .js files for my teams:

1) Do different pages/screens use sharply differentiated scripts? If so,
divide the scripts according to how they are partnered rather than
favoring a project-wide .js file.

2) If it is likely that scripts may have to be altered, having them all in
the same file can complicate troubleshooting problems during
development. Consider also the situation where different people are
simultaneously creating or altering script functionality.

3) Must some scripts be parsed as the page loads while others need
only be parsed when called? If so, divide them along these lines too
and take advantage of the 'defer' attribute to speed page display.

In general, I have never seen any performance advantage in throwing
everything into one file and other factors, as above, can be important.

Brett Merkey
http://web.tampabay.rr.com/bmerkey/
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phil Powell | last post by:
I'm sorry but I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure...
7
by: Dennis Roberts | last post by:
I have a script to parse a dns querylog and generate some statistics. For a 750MB file a perl script using the same methods (splits) can parse the file in 3 minutes. My python script takes 25...
13
by: Chris Smith | last post by:
'Morning, Within the next few months, I'm going to embark upon a comparatively rather large base of JavaScript code to be called from a web browser environment. Not too awfully huge, but...
55
by: Jonas Smithson | last post by:
I've seen a few attractive multi-column sites whose geometry is based on pure CSS-P, but they're what you might call "code afficionado" sites, where the subject matter of the site is "coding...
2
by: marco.avidano | last post by:
I'm asking: for the PHP parser, it's better to create one large file with all the code inside or a lot of small files? Can a large file slow down the execution of the script?
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
11
by: Dave Schwimmer | last post by:
I am relatively new to PHP. One of the things that seems glaring obvious to me (coming from a C/C++ background) is how 'open' everything seems - (AFAIK). For instance, URLs typically have the name...
6
by: Lenny Wintfeld | last post by:
Hi I'm attempting additions/changes to a Java program that (among other things) uses XSLT to transform a large (96 Mb) XML file. It runs fine on small XML files but generates OutOfMemory...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.