[Prototype-core] Re: New Idea for Prototype Compilation

2007-03-28 Thread Ryan Gahl
And to reiterate something... using a minifier and gzip, it becomes
something like ~14.5kb, which is like serving up a decent rez jpg thumbnail
image, which is like nothing. And if you're using Ajax you should be able to
minimize the number of times the lib needs to be served to a given
application space... and just to drive this whole thing further into the
ground, you should be sure your libs are being cached appropriately by the
browser, which of course makes the whole size thing even less of an issue
for subsequent requests to your application.

On 3/28/07, Mislav Marohnić <[EMAIL PROTECTED]> wrote:
>
> On 3/28/07, Eric Harrison <[EMAIL PROTECTED]> wrote:
> >
> > Unfortunately, the problem here
> > is that Prototype.js gets all of its power and smallish size by using
> > it's own functions extensively throughout the code.
>
>
> Eric gave a very good answer. Modules in Prototype framework can hardly be
> decoupled since they heavily depend on each other. BUT, I've been
> researching how to automate slimmed-down builds of Prototype, too - not for
> real world usage, but as a proof-of-concept.
>
> In real world you could take out a part of Prototype you don't use, but
> would want to put it back sooner or later. There is no part of Prototype
> that isn't useful for every-day usage.
>
> >
>


-- 
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-955-1457
Blog: http://www.someElement.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: New Idea for Prototype Compilation

2007-03-28 Thread Mislav Marohnić
On 3/28/07, Eric Harrison <[EMAIL PROTECTED]> wrote:
>
> Unfortunately, the problem here
> is that Prototype.js gets all of its power and smallish size by using
> it's own functions extensively throughout the code.


Eric gave a very good answer. Modules in Prototype framework can hardly be
decoupled since they heavily depend on each other. BUT, I've been
researching how to automate slimmed-down builds of Prototype, too - not for
real world usage, but as a proof-of-concept.

In real world you could take out a part of Prototype you don't use, but
would want to put it back sooner or later. There is no part of Prototype
that isn't useful for every-day usage.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: New Idea for Prototype Compilation

2007-03-28 Thread Eric Harrison

That's a great idea and it's one that has been brought up MANY times
before (and some people have gone so far as to do it themselves and a
few people have even forked prototype functionality into libraries
that are a little more lightweight). Unfortunately, the problem here
is that Prototype.js gets all of its power and smallish size by using
it's own functions extensively throughout the code. This gives
Prototype the ability to have a relatively small library (~70KB that
compresses with gzip to ~15k) with a LOT of functionality.

An easy example to understand is the $ function. A few years ago when
Prototype popularized this as a shortcut to document.getElementById(),
it was trivial to take JUST this function and use it in your code
because all it did was take the arguments passed to the function and
returned either an array of elements or returned an element by itself.

However, in recent versions of prototype, the $ function is now doing
a LOT more, and if you wanted to grab it, you'd need these things:

$(),
Element,
Element.extend(),
Object.extend(),
Object.clone(),
Element.extend.cache,
Element.Methods,
Form,
Form.Element,
Form.Element.Methods,

And that's just at the first level of function calls for $(). Once you
get into the Methods defined in Element.Methods, now you're looking at
various other functions that are required like all of the extensions
to String.prototype and Array.prototype and you'll also need the
Class.create() functionality as well as the Enumerable Class
definition.

This level of interlocking functionality makes Prototype tick, so to
speak, and simply would make an ala carte version of Prototype at best
a logistical nightmare and at worst an impossibility.

My final thought here is that even though YOU aren't using all of the
functionality of Prototype.js manually, Prototype.js is using all of
it's functionality. There are bits and pieces that you can safely
remove if you're not going to use them, but the vast majority of the
library needs to stay right where it's at. With gzip compression or
Rhino-based JavaScript minification, you can shrink Prototype.js down
in size considerably, so that's probably your best bet if size is your
concern.

Plus, I've found that just because I may not currently be using a
function or method from Prototype.js currently, I won't ever learn to
use it if it's not available. By keeping everything in place, you've
at least got a starting point to begin looking for something you need
to develop.

Good thought though. If you could build a working "compiler" for
Prototype that would let me select the functionality I need and
provide a working model for this system, I'd definitely eat my words
and be more than happy to use it in our production environments, but I
still think that it's probably not possible. Good luck!

-E


On 3/27/07, Leone Parise <[EMAIL PROTECTED]> wrote:
>
> Hi Group!
>
> I am a J2EE Developer and started to use Prototype framework for Ajax
> an other effects on my new works.
>
> It's is very powerfull, simple and made my work easyer to do, but it's
> to big.
>
> I think that 50% or more of the library that I didn't need (yet).
>
> My Idea is create a system to compile a custom library with only
> methods that I need.
>
> We can map each function(and its dependecies) a put it into a
> DataBank.
>
> When someone download the library can select the functions tha he
> wants and make his own library.
>
> It's only an Idea to improve Prototype.
>
> Tank's.
>
> Leone Parise
>
>
> >
>


-- 
Eric Ryan Harrison

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---