title: jQuery what is faster: selectors or methods?
body: <p>Let's say I have <code>$('mySelector:first');</code> and <code>$('mySelector').first();</code>. Which way is the most efficient? I looked in the source, but still couldn't figure it out.</p>
  
  <p>It looks like in the first case jQuery goes through every item until gets the first one:</p>
  
  <pre><code>CHILD: function( elem, match ) {
          var type = match[1],
          node = elem;
          switch ( type ) {
              ...
           case "first":
            while ( (node = node.previousSibling) )  {
             if ( node.nodeType === 1 ) { 
              return false; 
             }
            }
            if ( type === "first" ) { 
             return true; 
            }
            node = elem;
                  ...
          }
  }
  </code></pre>
  
  <p>In second case jQuery slices the collection, but I am not sure how efficient it is:</p>
  
  <pre><code>function first() {
    return this.eq( 0 );
  };
  
  function eq( i ) {
    return i === -1 ?
      this.slice( i ) :
      this.slice( i, +i + 1 );
  };
  </code></pre>