Discussion:
Packing on the function level
Eoghan
2010-02-09 17:25:57 UTC
Permalink
Has anyone made an attempt to pack up MochiKit omitting functions that
are not used?
e.g. include DateTime.toISODate but not DateTime.toPaddedAmericanDate
if the latter doesn't happen to be called in a given file.

I realise this would be non trivial to do automatically..
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mochikit+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
Fredrik
2010-02-09 17:55:16 UTC
Permalink
This should be possible using the Google Closure compiler:
http://code.google.com/closure/compiler/
(Some issues to watch out for: http://code.google.com/closure/compiler/docs/api-tutorial3.html#dangers)

I hope to find time to try this myself also, please report back about
your progress! Would be nice if MochiKit can be verified to be
compilable using Closure.

Regards
// Fredrik
Post by Eoghan
Has anyone made an attempt to pack up MochiKit omitting functions that
are not used?
e.g. include DateTime.toISODate but not DateTime.toPaddedAmericanDate
if the latter doesn't happen to be called in a given file.
I realise this would be non trivial to do automatically..
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mochikit+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
Eoghan
2010-02-10 15:57:02 UTC
Permalink
Thanks Fredrik, that's exactly what I'm looking for..

No luck compiling a packed version of MochiKit (1.5) and trying to
connect a signal - I get an error "MochiKit.i is undefined". The
closure inspector isn't working for me (FireBug 1.5.0) so I'm afraid I
can't further investigate at this time :-(
This should be possible using the Google Closure compiler:http://code.google.com/closure/compiler/
(Some issues to watch out for:http://code.google.com/closure/compiler/docs/api-tutorial3.html#dangers)
I hope to find time to try this myself also, please report back about
your progress! Would be nice if MochiKit can be verified to be
compilable using Closure.
Regards
// Fredrik
Post by Eoghan
Has anyone made an attempt to pack up MochiKit omitting functions that
are not used?
e.g. include DateTime.toISODate but not DateTime.toPaddedAmericanDate
if the latter doesn't happen to be called in a given file.
I realise this would be non trivial to do automatically..
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mochikit+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
Per Cederberg
2010-02-10 20:54:53 UTC
Permalink
Don't want to send stop-energy around, but is it really worthwhile to
pack MochiKit like that? I mean, the full MochiKit.js is only 197,5 kB
uncompressed. And the customizer we already have lets you pick quite
freely on the module level.

Have you double-checked what type of performance increases you'll see
in you load times if packing a smaller JS file? Perhaps just gzipping
the file will give you a similar speedup?

Cheers,

/Per
Post by Eoghan
Thanks Fredrik, that's exactly what I'm looking for..
No luck compiling a packed version of MochiKit (1.5) and trying to
connect a signal - I get an error "MochiKit.i is undefined".  The
closure inspector isn't working for me (FireBug 1.5.0) so I'm afraid I
can't further investigate at this time :-(
This should be possible using the Google Closure compiler:http://code.google.com/closure/compiler/
(Some issues to watch out for:http://code.google.com/closure/compiler/docs/api-tutorial3.html#dangers)
I hope to find time to try this myself also, please report back about
your progress! Would be nice if MochiKit can be verified to be
compilable using Closure.
Regards
// Fredrik
Post by Eoghan
Has anyone made an attempt to pack up MochiKit omitting functions that
are not used?
e.g. include DateTime.toISODate but not DateTime.toPaddedAmericanDate
if the latter doesn't happen to be called in a given file.
I realise this would be non trivial to do automatically..
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mochikit+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
Continue reading on narkive:
Loading...