On 8/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> newArray = Array.slice( arguments );


Yeah, this is known to us for some time. I've spent some time getting rid of
all the $A calls internal to Prototype (they're everywhere!) and replacing
them with Array.prototype.slice calls, but I never get around of finishing
that. I will, though, before 1.6.0 final. The thing is, I can't suggest this
change to the Prototype team unless I actually benchmark the performance.

also, for generating unique arrays:
>
> function uniqueArray( array ){
>    var uniqueHash = {}, unique=[], i;
>    for( i=array.length; i--; ){
>       if( !uniqueHash[ a[i] ]){
>          unique.push( array[i] );
>          uniqueHash[ a[i] ] = true;
>       }
>    }
>    return unique;
> }


This is a very nice hack! I'll benchmark that also.

and is there any reason not to use String.replace([regexp], function()
> {} ) for a large part of the functions implemented by iterating
> through arrays?  this can be blazingly fast even for complicated regex
> as long as they are precompiled, and the code is far more readable and
> compact (i.e. camelization, templating, etc etc )


Nothing prevents you from submitting patches. We will welcome optimizations
for camelization, templating and related stuff.

and --- a big kudos to the prototype team -- discovering prototype way
> back when completely changed the way i code javascript - thanks.


Discovering Prototype taught me JavaScript, also. Probably because it didn't
have any documentation back then :)

Thanks for the suggestions. As I've already said: focus on the string stuff
and see if you can get a performance boost. Camelization, for instance, was
a bottleneck in setStyle :(

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to