Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2009-11-12:

[7:12] <Dantman> Bleh, well screw ThreadGroups
[11:36] <ondras> hey guys
[11:37] <ondras> is there any reason for "var a = 'apply'; f = function(){}; f[a]()" being faster than "f.apply()" ?
[11:51] <ashb> your engine is broken :)
[11:53] <frodenius> wow it really is
[11:53] <frodenius> at least in ff
[11:54] <ashb> which version of FF, and how much faster?
[11:55] <ondras> in my ff, these are the same
[11:56] <ondras> but I saw this extremely strange approach in raphael sources
[11:56] <ondras> and I truly wonder what is the reason...
[11:56] <ashb> so its less characters
[11:57] <ondras> actually, raphael contains "var apply = 'apply'; f[apply](...)"
[11:57] <ashb> dont know then.
[11:57] <ondras> so it is one more character :)
[11:57] <frodenius> ok it actually is not
[11:57] <frodenius> javascript bot was not up to date
[11:57] <ashb> if anything it should be slower
[11:57] <frodenius> yes, slightly
[11:57] <ashb> can't see a case logically when it would be faster tho
[11:58] <ondras> me too
[11:58] <ondras> very very strange approach
[11:59] <dom> that's for minification
[11:59] <ashb> minfiers dont detect that themselves?
[11:59] <dom> if you use the property apply many times it ends up shorter
[11:59] <dom> no
[12:00] <dom> tbf, gzip does a better job against dot notation than square bracket, so -shrug-
[12:00] <dom> foo.reallyLongProperty 5 times is shorter after gzipping than a = "reallyLongProperty"; and foo[a] 5 times
[12:00] <ashb> yeah
[12:00] <dom> but the latter is shorter before gzipping
[12:01] <ashb> people generally think 'oh but shorter text is better'
[12:01] <ashb> POITROAE and all that
[12:01] <dom> I'll be using the square bracket notation for Thin \o/
[12:02] * ondras prefers dotted notation where applicable
[12:02] <dom> under 1k pre gzipping and all that. will provide instructions for repacking it for those people who want the ~20 extra bytes pre gzipping for the ~5 fewer bytes post gzipping
[12:02] <ondras> .)
[12:03] <dom> the dotted notation is clearer for sure. I'm waiting for closure compiler to expose the option that deals with this case
[12:03] <dom> to see if it can go from dotted notation to square bracket notation automatically
[12:03] <dom> then I can keep my dev code clean with dot notation :D
[12:03] <ashb> right. dimsum time
[12:03] <ashb> om
[12:03] <ashb> &
[12:04] <dom> envy

 

 

Logs by date :