JavaScript File Compression

J

josh.tucholski

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.
 
J

Jim Ley

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.
 
J

josh.tucholski

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.
 
J

Jim Ley

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.
 
J

josh.tucholski

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top