473,597 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ 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)cybers pace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #1
1 1914
"Christophe r 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
2984
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 out how to do this in bash script as the requirement is necessary for a migration script to obtain the code from a .cfg file and then be able for the "parent" script to run the code it "imported" from the .cfg file, much like PHP's require() or...
7
2195
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 minutes. It is enough of a difference that unless I can figure out what I did wrong or a better way of doing it I might not be able to use python (since most of what I do is parsing various logs). The main reason to try python is I had to look at...
13
1904
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 probably between 10K and 15K LoC. Having seen only the kinds of scripts that support interactive web pages, I'm dreading trying to stretch JavaScript that far. Has anyone here done something like this, and want to share some experience? In my...
55
5140
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 practices." (One example of this is alistapart.com.) However, the project/development realities for small boutique sites are completely different from those of large commercial or institutional sites -- and I was curious to see what coding approaches...
2
2678
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
2976
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 ************************************************************************************ <Script runat="Server"> Sub fnHeader(client As String) response.write("<!-- #include file = ../includes/staffingHeaders.inc -->")
11
1613
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 of the php script that they are calling - also just viewing the source of most web pages will show you in glorious detail, the paths and names to any PHP scripts they may be using. If one was to implement user authorisation (or any other module...
6
4971
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 exceptions with large XML files. I tried a simple punt of -Xmx512MB but that didn't work. In the future, the input XML file may become considerably bigger than 96 MB, so even if it did work, it probably would be putting off the inevitable to some later...
20
4250
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 is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black blob) ... all the pages were created in Notepad over the last
0
7962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8258
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2394
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 we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1229
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.