Skip to main content
Topic: Bananascript javascript scruncher (Read 2840 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Bananascript javascript scruncher

Was just wondering: back when the code for scrunching CSS and js files was being written, did you guys ever check out the code behind Bananascript? It's capable of knocking down jquery_1.11.2.min.js from 94kb to 52kb, which is quite an improvement on an already minified library.

As far as I got when testing anything, the resulting code always worked. I was using it for scrunching SMF js files for custom theming too.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Bananascript javascript scruncher

Reply #1

Where's the code at? Just looks like a service.

Re: Bananascript javascript scruncher

Reply #2

Dunno where it's hiding. I know Arantor managed to reverse engineer it. Which he said was a bit of a mission. Could try asking him about it.

Or, you could just ask the dude who wrote it if he would be prepared to part with code for a good cause.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Bananascript javascript scruncher

Reply #3

Since what it does is a sort of compression, wouldn't be easier to serve the files as gzip packages?

ETA: of course it doesn't mean it's easier because I always had problems in sending gzip instead of plain text files. O:-)
Bugs creator.
Features destroyer.
Template killer.

Re: Bananascript javascript scruncher

Reply #4

Never heard of it before ...

Certainly doing some form of compression wrapper, gzip or other.   I'm probably wrong but I think that would mean the browser has to uncompressed the file each time its used?  Or maybe it can uncompress it just once to the browser cache?

You save some amount of single time bandwidth (since the files are cached by the browser) at the expense of the computational overhead of uncompressing them.  Not sure which would end up better, probably chasing gnat farts.

Re: Bananascript javascript scruncher

Reply #5

What the site does is basically: convert all the js to a text string, find some repeated patterns and replace them with placeholders, then wrap everything into some code that, client-side, does the "counter replacement" putting back the repeated patterns and ends with an equivalent of eval(string_of_code).
Bugs creator.
Features destroyer.
Template killer.

Re: Bananascript javascript scruncher

Reply #6

Yeah, what Ema said, AFAICT. Makes for very small files without gzipping.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Bananascript javascript scruncher

Reply #7

So it does require the client to "unpack" the JS file before it can be used, and perhaps each time ... interesting concept, not sure  about whats really better for the client, a few more bits or a bit more processing.
Last Edit: February 29, 2016, 05:22:57 pm by Spuds

Re: Bananascript javascript scruncher

Reply #8

Dunno. If it aint done with CSS, I have no idea. :P I just thought it was interesting and was wondering if it was worthwhile.

It should give less load on the server, and less bandwidth usage. Client? Not so sure. I suppose I could drop the dude an email and ask.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Bananascript javascript scruncher

Reply #9

I think we're better off without having the client do decompression at the Javascript level.