Well, first I would argue that the two are not equivalent.

$($(...)[x]) doesn't maintain the stack. You can no longer do:
$(...).eq(1).addClass("test").end().appendTo("#foo");
$($(...)[x]) doesn't maintain the internal selector state for plugins.
For example if you checked $(...).eq(1).selector you'd see: ".slice(1,
2)"

So, with that in mind, if there were ways to maintain that
functionality and still get a performance speed-up, I'd definitely be
open to it.

--John



On Wed, Feb 25, 2009 at 11:41 PM, Ricardo Tomasi <[email protected]> wrote:
>
> Creating two jQuery objects + a lookup $( $(...)[x] ) is faster than a
> simple $(...).eq(x). That doesn't make much sense.
>
> Currently the eq function looks like this:
> eq: function( i ) {
>        return this.slice( i, +i + 1 );
> },
>
> Are there any downsides to changing it to this (object unique IDs,
> chaining)?
>
> eq: function( i ) {
>        return jQuery(this[i]);
> },
>
> That offers a 25% to 40% speed improvement across all browsers.
> http://jquery.nodnod.net/cases/177
>
> cheers,
> - ricardo
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to