473,804 Members | 4,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript File Compression

I'm looking for some tools that allow us to implement Javascript Header
File Compression. I know there are parsers out there that kill all the
commenting and obliverate the code to make it as small as possible, but
perhaps if I show our situation we have this may make more sense.

Our web application has a backbone engine that is downloaded to the
end-users computer. Currently at a state of 30-40% complete, the main
engine is over 600 KB and consumes 17,000 lines of code. When this has
been completed, we expect it to be well near 100,000 lines and are
quite unsure of the size the file. Is there anything that can compress
the file to allow for faster downloading to the user only to have it
uncompressed once they use it on their local machine?

Thanks.

Feb 14 '06 #1
5 1800
On 14 Feb 2006 07:22:47 -0800, jo************@ gmail.com wrote:
I'm looking for some tools that allow us to implement Javascript Header
File Compression. I know there are parsers out there that kill all the
commenting and obliverate the code to make it as small as possible, but
perhaps if I show our situation we have this may make more sense.
the tool is called gzip, and is handled transparently by the majority
of web-servers out there, it simply needs enabling.
Our web application has a backbone engine that is downloaded to the
end-users computer. Currently at a state of 30-40% complete, the main
engine is over 600 KB and consumes 17,000 lines of code. When this has
been completed, we expect it to be well near 100,000 lines and are
quite unsure of the size the file.


It sounds pretty silly to download 100,000 lines of code in a single
chunk regardless, why not break the application down into smaller?
chunks downloaded as and when needed?

Jim.
Feb 14 '06 #2
jo************@ gmail.com wrote in news:1139930567 .842026.50800
@o13g2000cwo.go oglegroups.com:
Our web application has a backbone engine that is downloaded to the
end-users computer. Currently at a state of 30-40% complete, the main
engine is over 600 KB and consumes 17,000 lines of code. When this has
been completed, we expect it to be well near 100,000 lines and are
quite unsure of the size the file.


as noted in a followup, this is close to sheer madness!! surely not all
pages in your site make use of every class,function and/or variable in your
script? you should *absolutely* be breaking up that file into several
'.js' files, and calling only the ones you need as per page requirements.

an alternative to mod_gzip way of compression [
http://www.schroepl.net/projekte/mod_gzip/ ] (which is actually very
excellent unless you are serving up PDF files) is running your scriptS
through various 'js minimizers' - things that strip out your comments,
whitespaces and carriage returns. you can use that in your pages, and keep
the non-minimized one as your development script.
Feb 14 '06 #3
Sorry for not clarifying this, however the Web Application itself is
split up into 2-3 thousand lines of code, based on each page module or
state the user is during the lifetime of the application. However the
backbone engine that has all of the methods required to communicate
with the webservice must be kept in one piece. As it approaches 600KB
this does not seem to cause any problems, especially since the files
are cached and only grabbed if needed again.

To get a idea of the extent of this engine, please take a look at
http://webservice.mynaid.com/ajax/jsdocs/. Thanks.

Feb 14 '06 #4
On 14 Feb 2006 15:25:59 -0800, jo************@ gmail.com wrote:
Sorry for not clarifying this, however the Web Application itself is
split up into 2-3 thousand lines of code, based on each page module or
state the user is during the lifetime of the application. However the
backbone engine that has all of the methods required to communicate
with the webservice must be kept in one piece.
I don't see why? Why do you need to download the code to do a state
lookup if the user is looking at animal breeds - just have the blocks
download later.
As it approaches 600KB
this does not seem to cause any problems, especially since the files
are cached and only grabbed if needed again.


600kb of js takes a long time to compile, there's not just download
time.

Jim.
Feb 15 '06 #5
Jim,

We could for our application split the files up and call them as
needed, however this engine is also intended for other 3rd party
developers to be able to plug into and use as well. Due to the cross
domain restrictions, they'll need the copy of the engine on their side
and cant access it from our site. It would be easier to give them just
one file instead of split it into 60-some odd files (easy for updates
in the end), however I was just checking if there were any way for the
compression. I'll look at gzip...thanks for the recommendation.

Feb 15 '06 #6

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

Similar topics

8
8847
by: Dennis Hotson | last post by:
Hi, I'm trying to write a function that adds a file-like-object to a compressed tarfile... eg ".tar.gz" or ".tar.bz2" I've had a look at the tarfile module but the append mode doesn't support compressed tarfiles... :( Any thoughts on what I can do to get around this?
4
5666
by: - - Pierre | last post by:
Hi all, I'm trying to come up with a script and I'm having a heck of a time... I require users to enter the size (in MB or KB) of the attachment they wish to transfer/upload. As they enter the number and move over to the next field (using onBlur or...), I would like a popup/alert window warning them that this attachment size would take "x" amount of time based on a speed of 24 kilobits per second (kbps). If they are happy with the...
15
2340
by: Matt Kruse | last post by:
I am far from a PHP expert, and I've been struggling to create a function which will take a javascript .js file and "compact" it as much as possible. Meaning, remove all comments and unnecessary whitespace. "Obfuscation" is not necessary. Obviously, the compacted javascript should run identically to the original javascript. Can anyone point me to an existing function that does this? Thanks!
8
11725
by: vnarayana | last post by:
Need to transfer large data (Appox 5MB in the form of XML & HTML) from Internet Explorer to Web sphere application server. Want to know if there is anyway I can compress data (JavaScript or otherwise) before sending it to the server as it takes a long time to do this operation. I am currently using xmlhttp. Sample code below. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); xmlhttp.open("POST",'http://xyz.com',true); var vSendXML =...
22
4014
by: petermichaux | last post by:
Hi, I'm curious about server load and download time if I use one big javascript file or break it into several smaller ones. Which is better? (Please think of this as the first time the scripts are downloaded so that browser caching is out of the equation.) Thanks, Peter
6
4838
by: Chetan Patil | last post by:
I would like to obfuscate and compress (remove comments, newlines etc) my javascript files / ajax code. Is there a module that will do this on the fly with some level of caching? Does such a beast exist? thx Gupit
20
3307
by: twigster | last post by:
Hey everyone, I'm looking for a good way to obfuscate some Javascript code. Does anyone have a good experience or bad experience with a particular software? thanks
6
2593
by: Aaron Gray | last post by:
Hi, Is there any tool that will concatinate JavaScript files compacting them spacewise and removing comment fields ? I have some sed script that sort of does the job but was wondering if there were any hopefully open source tools that will do the job. I don't want encryption or obverscation though.
1
1353
by: Pierre | last post by:
hi, is there somewhere an implementation of some compression algorithm zip/ gzip/other ? Pierre
0
9710
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
9589
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
10340
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...
1
10329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6858
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
5527
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4304
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
2
3830
muto222
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.