|
From: Pascal B. <pa...@dy...> - 2000-12-08 18:19:03
|
As I said, I might be missing the advantage here, but having one short file would indeed make it easy to distribute things.. still I don't think jar and gzip are of any use if not all browser can handle them safely. I know you could use a combination of JAR for NS and gzip for IE5+ and a js file for ie4, but personally I don't see the usage of it ;) maybe I should give it a closer look and, very maybe, I'll make a win32 app to do the jspacking because using that perl stuff is to linux for me :) Pascal Bestebroer pa...@dy... http://www.dynamic-core.net > -----Oorspronkelijk bericht----- > Van: dyn...@li... > [mailto:dyn...@li...]Namens Dan Steinman > Verzonden: vrijdag 8 december 2000 21:33 > Aan: dyn...@li... > Onderwerp: Re: [Dynapi-Dev] compression? > > > Pascal, initially I wasn't so hot to trot with whitespace > compression either, but after playing around with it it's really > quite cool, and I'm glad I put in the time to create my little > jspack util. If you check again, the compression ratio is closer > to about 30%, more or less depending on how many comments you put > in there. All the /api/ files were "manually" compress. I don't > particularly enjoy reading code that is like this: > > if(b)c=2 > else if(a&&b||c&&d<=4)method() > else {method();return false} > > And with the system set up now, we won't have to. You just write > your code, putting in all the comments and whitespace you want, > and (as long as the ;'s are correct) it will all be squished down > for you in a build release. > > Also, jspack compresses stuff that gzip/jar's can't do much with, > like the following: > > if (a) { > > } > else if (b || c) { > > } > > The spaces and line breaks have to be maintained. But in a > jspacked version: > > if(a){}else if(b||c){} > > It's already taken care of. After you jspack, and jar/gzip it, > you're up to over 80% compression (85% for dynapi2 currently). > Whereas gzip on it's own can only do about 60%. Plus by > whitespace compression, each individual file can be compressed, > whereas there's no point in having an individual gzip/jar file > for each js file because you don't gain much in small files. > > Another thing that's kinda cool, imagine when you build a game, > or standalone app in JS. When you want to release the app to the > public, you can build your own JS pack file with the code you > need all in there (GPL license allows u to do this if the program > you wrote is also GPL). I'm rewriting my tetris game, so I'd > make a jspack for it with: > > jspack -o tetris-packed.js tetris.js ../dynapi/dynapi.js > ../dynapi/api/ ../dynapi/gui/image.js > > That produces a single js file with all the code I need squished > together. This is an ideal way to publish js apps or games IMO > because you no longer need to include the entire dynapi with your > app (or copy select files along . > > Dan > > > On Fri, Dec 08, 2000 at 12:49:06PM +0100, Pascal Bestebroer wrote: > > Not to be raving on anybodys parade, but whitespace compressions isn't > > really worth it is it? You only stripped about 4kb off the > complete api/ > > folder (dynlayer,dyndocument,etc..) if you remove all comments and > > semi-colons from the un-"compressed" files, you will probably > end up with > > even less "compression". > > > > I know that compression on all widgets might give more > advantage, but then > > again when will you be actually using all widgets? > > > > I think the jar and gzip are great, but jar won't work in IE, > and I don't > > think gzip works in ie4 (and how about IE on Macs?) > > > > Am I missing some advantage in this? > > > > > > > > Pascal Bestebroer > > pb...@oi... > > http://www.oibv.com > > > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > |