473,320 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1777
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.googlegroups.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
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...
4
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...
15
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...
8
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...
22
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...
6
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...
20
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
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...
1
by: Pierre | last post by:
hi, is there somewhere an implementation of some compression algorithm zip/ gzip/other ? Pierre
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.