[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-05 Thread Mislav Marohnić
On 9/5/07, jdalton [EMAIL PROTECTED] wrote: In some cases, other functions build off of these base functions and the slow down can eventually grow For example using large arrays or calling a method 1000+ times that make heavy use of the Enumerable helpers is slow compared using a

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-05 Thread Thomas Fuchs
Am 05.09.2007 um 04:11 schrieb jdalton: Other rant: Also I don't see a valid argument for not using opening and closing conditional brackets { }... Its a few brackets here and there that would make the code soo much less cryptic. I think that gzipping and this would still keep the filesize

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-05 Thread jdalton
Hi Thomas, I concede the $w() point. I did not know that using brackets is slower. How much so and are there benchmarks for that claim? I agree that: If(blah) return; Is fine, I do little stuff like that in my code, but lets use a real example: http://pastie.caboo.se/private/y6hmgibpglrlwlknms

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-05 Thread Jeff Watkins
Ultimately, this and several other topics come down to the fact that Prototype is the JavaScript library for Ruby programmers. This isn't bad, it's just something that non-Ruby coders like myself have to come to grips with. Prototype prefers method names like uniq rather than unique, for

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-05 Thread Jeff Watkins
On Sep 5, 2007, at 7:28 AM, Thomas Fuchs wrote: Am 05.09.2007 um 16:22 schrieb jdalton: I did not know that using brackets is slower. No, that's just a claim. :) I'd welcome benchmarks for this (i've the feeling it's not really measurable, but you never know...). Thomas, brackets once

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-04 Thread Jerod Venema
On 9/3/07, Tobie Langel [EMAIL PROTECTED] wrote: FYI, some rough benchmarking in Safari using the benchmarking function of unit tests: benchmark(function(){ var colors = $('blue red green violet'); }, 1) benchmark(function(){ var colors = ['blue',

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-04 Thread jdalton
In some cases, other functions build off of these base functions and the slow down can eventually grow For example using large arrays or calling a method 1000+ times that make heavy use of the Enumerable helpers is slow compared using a traditional for loop. I think that using the array is

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-03 Thread Andrew Red
These lines occur only once when loading the framework. The difference is insignificant. You're right. Yet readability and clarity is. Also, there's more chance to make error in a concatenated space-containing sting, like it's in lines #2368-2369, than in an array of strings. $w('colSpan

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-03 Thread Ken Snyder
Andrew Red wrote: Gentlemen, I notice a function which breaks a string into array of words ( $w() ) is used along the code very indiscriminately just when a simple array would suffice. ... Andrew, I'm also new to the Ruby world. It seems that the $w() function has an analogous %w() in

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-03 Thread Mislav Marohnić
On 9/3/07, Andrew Red [EMAIL PROTECTED] wrote: So, summing you up, each time before we have an vanilla array from the spaces-delimited string we go through: string - stack hop - stack hop - replace(/^\s+/, '') - replace(/\s+ $/, '') - stack back hop - branching - split(/\s+/) - stack back

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-03 Thread Andrew Red
)) Okay, okay. Your way. ) On Sep 3, 10:19 pm, Mislav Marohnić [EMAIL PROTECTED] wrote: On 9/3/07, Andrew Red [EMAIL PROTECTED] wrote: So, summing you up, each time before we have an vanilla array from the spaces-delimited string we go through: string - stack hop - stack hop -

[Prototype-core] Re: Indiscriminate use of breaking into words function $w()

2007-09-03 Thread Tobie Langel
FYI, some rough benchmarking in Safari using the benchmarking function of unit tests: benchmark(function(){ var colors = $('blue red green violet'); }, 1) benchmark(function(){ var colors = ['blue', 'red', 'green', 'violet']; }, 1) Info: Operation