:first when finding 1 of 1, 1 of many (v2)

Revision 2 of this benchmark created by Matt Ebel on


Description

How does :first affect performance when finding the first of ONE in the DOM, and how does it perform when finding the first of MANY in the DOM?

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<form name="detailform" id="detailform" action="https://skywardinc.iscorp.com/scripts/wsisa.dll/WService=wsfininhouse/seplog01.w" method="post" target="">
        <input type="hidden" name="hCompName" id="hCompName" value="SKYWEB25A"><input type="hidden" name="hOSName" id="hOSName" value="Windows NT">
        <div id="pageOuterWrap" class="normal noheader sepadm01"><div id="pageInnerWrap" class="mode">
                <div id="dMessage" style="display:none; position:absolute; top:1px; left:1px; cursor:default; z-index:300; overflow-x:display;" onmousedown="gDoDim=false;" role="alertdialog" aria-labelledby="msgTitle">
                        <div id="msgBodyTable">
                                <div id="msgTitle" onmousedown="gDoDim=false; setMouseStart(event,&quot;dMessage&quot;);" onmouseup="gFilter=&quot;&quot;"></div>
                                <div id="msgBodyCol"></div><div id="msgActions" class="msgActions">
                                        <span class="msgBtnWrap">
                                                <a class="button" id="msgBtn1" tabindex="5" href="javascript:void(0)" role="button" style="width:100px;">&nbsp;</a>
                                        </span>
                                        <span class="msgBtnWrap">
                                                <a class="button" id="msgBtn2" tabindex="6" href="javascript:void(0)" role="button" style="width:100px;">&nbsp;</a>\
                                        </span>
                                        <span class="msgBtnWrap">
                                                <a class="button" id="msgBtn3" tabindex="7" href="javascript:void(0)" role="button" style="width:100px;">&nbsp;</a>
                                        </span></div></div>
                                </div>
                                <div id="lockDiv" style="z-index:100; position:absolute; left:0px; top:0px; height:0px; width:0px; visibility:hidden; background-color:#000000; opacity:0.50; filter:alpha(opacity=50);" oncontextmenu="return false;"></div>
                                <div id="dPrintMessage" style="display:none; position:absolute; top:1px; left:1px; cursor:default; z-index:300; overflow-x:display;" onmousedown="gDoDim=false;">
                                <table cellspacing="0" id="printMsgBodyTable">
                                        <tbody>
                                                <tr class="printMsgTitle">
                                                        <td class="titleLeft">&nbsp;</td>
                                                        <td class="printMsgTitle" id="printMsgTitle" onmousedown="gDoDim=false; setMouseStart(event,&quot;dPrintMessage&quot;);" onmouseup="gFilter=&quot;&quot;">
                                                </td>
                                                        <td class="titleRight">&nbsp;</td>
                                                </tr>
                                                <tr class="printMsgBody">
                                                        <td id="printMsgBodyCol" valign="top" colspan="3">
                                                        </td>
                                                </tr>
                                                <tr class="printMsgActions">
                                                        <td class="actionsLeft">&nbsp;</td>
                                                        <td id="printMsgActions">
                                                                <span style="float:left;">
                                                                <a class="button" id="printMsgBtn1" tabindex="5" href="javascript:void(0)" role="button">&nbsp;</a>
                                                                </span>
                                                                <span style="float:right;">
                                                                <a class="button" id="printMsgBtn2" tabindex="6" href="javascript:void(0)" role="button">&nbsp;</a>
                                                                </span>
                                                        </td>
                                                        <td class="actionsRight">&nbsp;</td>
                                                </tr>
                                        </tbody>
                                </table>
                        </div>
                        <div id="contentWrap">
                            <div id="loginOuterWrap">
                                <div id="loginBoxWrap">
                                    <div id="loginHeaderWrap">
                                        <div id="loginHeader">
                                            <div id="loginBrading">
                                                <img src="/webspeed/wfssky01.gif" alt="Skyward Logo" height="88" width="150">
                                            </div>
                                            <div id="loginDistrict">SKYWARD</div>
                                        </div>
                                    </div>
                                    <div id="loginBodyWrap">
                                        <div id="loginBody">
                                            <table cellspacing="0" cellpadding="0">
                                                <tbody>
                                                    <tr>
                                                        <td class="loginLabel">Login ID:</td>
                                                        <td class="loginData">
                                                                <input type="text" class="EditInput" name="login" id="login" autocomplete="off" tabindex="5" onkeydown="return checkKey(event, this);" style="width: 163px; background-color: rgb(208, 255, 176); outline: rgb(127, 157, 185) solid 1px;" maxlength="50" size="28" origvalue="" det="true" autocapitalize="off" autocorrect="off" spellcheck="false" aria-labelledby=" hValueChanged">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="loginLabel">Password:</td>
                                                        <td class="loginData">
                                                                                                <input type="password" class="EditInput" name="password" id="password" autocomplete="off" tabindex="10" onkeydown="return checkKey(event, this);" style="width:163px; " maxlength="100" size="28" det="true">                                
                                                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" class="loginButton">
                                                                <a class="button" id="bLogin" tabindex="15" href='javascript:if (cbs("bLogin")) {tryLogin();}' role="button">Sign In</a>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                            <div id="version" tooltip="&lt;b&gt;05&lt;/b&gt; = &lt;i&gt;SIF&lt;/i&gt; version number&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;.&lt;b&gt;13&lt;/b&gt; = The &lt;i&gt;Year&lt;/i&gt; the Full Release was distributed (2013)&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&lt;b&gt;10&lt;/b&gt; = The &lt;i&gt;Month&lt;/i&gt; the Full Release was distributed (October)&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&lt;b&gt;00&lt;/b&gt; = Increments with each &lt;i&gt;PMP&lt;/i&gt; that is distributed after the Full Release&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&lt;b&gt;03&lt;/b&gt; = Increments for each &lt;i&gt;Addendum&lt;/i&gt; after the PMP&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&lt;b&gt;10.2&lt;/b&gt; = Indicates the Database Version." tooltip-position="right" tooltip-width="450px">05.13.10.00.03-10.2</div>
                                        </div>
                                    </div>
                                </div>
                                <div id="loginAreaWrap">
                                    <div id="loginArea">
                                        <table cellspacing="0" cellpadding="0">
                                            <tbody>
                                                <tr>
                                                    <td class="loginLabel">Login Area:</td>
                                                    <td class="loginData">
                                                                                        <select class="EditSelectFixed" name="cUserRole" id="cUserRole" tabindex="15" style="width:168px;" size="1" origvalue="" det="true">
                                                                                                <option class="findMe" data-find="findMe" id="findMe">Secured Access</option>
                                                                                        </select>                            
                                                                                </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                        <div id="errorPanel" class="noErrors">
                                                <noscript>&lt;h1&gt;&lt;span&gt;JavaScript&lt;/span&gt; Error&lt;small&gt;JavaScript is turned off in your web browser. This site requires JavaScript to be enabled before you can proceed.&lt;/small&gt;&lt;/h1&gt;</noscript>
                                        </div>        
                            </div>
                        </div>
                        <div id="loginFooterWrap" style="top: 446px;">
                                <div id="copyArea" ondblclick="toggleIHDetails();">© 2013 
                                        <a href="http://www.skyward.com/" target="_blank">Skyward, Inc.</a> 
                                        All rights reserved.
                                </div>
                                <div id="infoArea">
                                        <div id="BrowserVersionContainer">
                                                Windows 7 / Chrome 30
                                        </div>
                                </div>
                                <br>
                        </div>
                        <input type="button" role="button" id="bFakeClose" onclick="self.close();" style="height:0px; width:0px; display:none;">
                        <input type="hidden" name="dwd" id="dwd" value="">
                        <input type="hidden" name="wfaacl" id="wfaacl" value="">
                        <input type="hidden" name="encsec" id="encsec" value="">
                        <input type="hidden" name="entity" id="entity" value="">
                        <input type="hidden" name="entities" id="entities" value="">
                        <input type="hidden" name="SecurityMenuID" id="SecurityMenuID" value="0">
                        <input type="hidden" name="HomePageMenuID" id="HomePageMenuID" value="0">
                        <input type="hidden" name="LinkNames" id="LinkNames" value="">
                        <input type="hidden" name="nameid" id="nameid" value="">
                        <input type="hidden" name="MobileId" id="MobileId" value="">
                        <input type="hidden" name="hNavMenus" id="hNavMenus" value="">
                        <input type="hidden" name="hNavSubMenus" id="hNavSubMenus" value="">
                        <input type="hidden" name="hNavSearchOption" id="hNavSearchOption" value="all">
                        <input type="hidden" name="hSecCache" id="hSecCache" value="0 items in 0 entities">
                        <input type="hidden" name="LinkData" id="LinkData" value="">
                        <input type="hidden" name="passedparams" id="passedparams" value="">
                        <input type="hidden" name="vMaintOption" id="vMaintOption" value="">
                        <input type="hidden" name="CurrentProgram" id="CurrentProgram" value="skyportlogin.w">
                        <input type="hidden" name="CurrentVersion" id="CurrentVersion" value="010141">
                        <input type="hidden" name="SuperVersion" id="SuperVersion" value="011726">
                        <input type="hidden" name="PaCVersion" id="PaCVersion" value="05.13.10.00.03-10.2">
                        <input type="hidden" name="currentrecord" id="currentrecord" value="">
                        <input type="hidden" name="BrowseRowNumber" id="BrowseRowNumber" value="">
                        <input type="hidden" name="Browser" id="Browser" value="Chrome">
                        <input type="hidden" name="BrowserVersion" id="BrowserVersion" value="30">
                        <input type="hidden" name="BrowserPlatform" id="BrowserPlatform" value="Win32">
                        <input type="hidden" name="TouchDevice" id="TouchDevice" value="false">
                        <input type="hidden" name="OpenRow" id="OpenRow" value="">
                        <input type="hidden" name="OpenDetails" id="OpenDetails" value="">
                        <input type="hidden" name="PopupWidth" id="PopupWidth" value="">
                        <input type="hidden" name="PopupHeight" id="PopupHeight" value="">
                        <input type="hidden" name="noheader" id="noheader" value="yes">
                        <input type="hidden" name="vSelectMode" id="vSelectMode" value="">
                        <input type="hidden" name="PreviousProgram" id="PreviousProgram" value="">
                        <input type="hidden" name="duserid" id="duserid" value="-1">
                        <input type="hidden" name="RefreshMode" id="RefreshMode" value="">
                        <input type="hidden" name="hIPInfo" id="hIPInfo" value="71.87.22.130">
                        <input type="hidden" name="hBrowseFirstRowid" id="hBrowseFirstRowid" value="">
                        <input type="hidden" name="HomePage" id="HomePage" value="sepadm01.w">
                        <input type="hidden" name="hApplyingFilter" id="hApplyingFilter" value="">
                        <input type="hidden" name="hRepositioning" id="hRepositioning" value="">
                        <input type="hidden" name="loginID" id="loginID" value="-1">
                        <input type="hidden" name="pDesc" id="pDesc" value="">
                        <input type="hidden" name="pProgram" id="pProgram" value="">
                        <input type="hidden" name="pParams" id="pParams" value="">
                        <input type="hidden" name="pPath" id="pPath" value="">
                        <input type="hidden" name="pInfo" id="pInfo" value="">
                        <input type="hidden" name="pType" id="pType" value="">
                        <input type="hidden" name="pSrpplmIn" id="pSrpplmIn" value="">
                        <input type="hidden" name="pPriority" id="pPriority" value="">
                        <input type="hidden" name="pButtons" id="pButtons" value="">
                        <input type="hidden" name="fileUploadLimit" id="fileUploadLimit" value="">
                        <input type="hidden" name="blobid" id="blobid" value="">
                        <input type="hidden" name="pEnc" id="pEnc" value="">
                        <input type="hidden" name="fileInputId" id="fileInputId" value="">
                        <input type="hidden" name="delAttachReturn" id="delAttachReturn" value="">
                        <input type="hidden" id="hUseCGIIP" name="hUseCGIIP" value="yes">
                        <input type="hidden" name="hScrollBarWidth" id="hScrollBarWidth" value="">
                        <input type="hidden" name="UserSecLevel" id="UserSecLevel" value="5">
                        <input type="hidden" name="UserLookupLevel" id="UserLookupLevel" value="5">
                        <input type="hidden" name="hAnon" id="hAnon" value="bjlbYpAByijcxUsV">
                        <input type="hidden" name="pState" id="pState" value="WI">
                        <input type="hidden" name="pCountry" id="pCountry" value="US">
                        <input type="hidden" name="hDistSerial" id="hDistSerial" value="4666ea53w">
                        <input type="hidden" name="hDisplayBorder" id="hDisplayBorder" value="true">
                        <input type="hidden" name="hAlternateColors" id="hAlternateColors" value="true">
                        <input type="hidden" name="BrowserName" id="BrowserName" value="">
                        <input type="hidden" name="web-data-recid" id="web-data-recid" value="">
                        <input type="hidden" name="wfaacl-recid" id="wfaacl-recid" value="">
                        <input type="hidden" name="User-Type" id="User-Type" value="">
                        <input type="hidden" name="tempAccess" id="tempAccess" value="">
                        <input type="hidden" name="screenWidth" id="screenWidth" value="1920">
                        <input type="hidden" name="screenHeight" id="screenHeight" value="1080">
                        <input type="hidden" name="showTracker" id="showTracker" value="">
                        <input type="hidden" name="displaySecond" id="displaySecond" value="">
                        <input type="hidden" name="insecure" id="insecure" value="">
                        <input type="hidden" name="redirectTo" id="redirectTo" value="">
                        <input type="hidden" name="hforgotLoginPage" id="hforgotLoginPage" value="seplog01">
                        <input type="hidden" name="userAgent" id="userAgent" value="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36">
                        <input type="hidden" name="osName" id="osName" value="Windows 7">
                        <input type="hidden" name="brwsInfo" id="brwsInfo" value="Chrome 30">
                        <input type="hidden" name="subversion" id="subversion" value="30">
                        <input type="hidden" name="supported" id="supported" value="true">
                        <input type="hidden" name="pageused" id="pageused" value="Desktop">
                        <input type="hidden" name="recordLimit" id="recordLimit" value="30">
                        <input type="hidden" name="hFilterOpen" id="hFilterOpen" value="">
                        <input type="hidden" name="filterElementList" id="filterElementList" value="">
                        <input type="hidden" name="currentbrowse" id="currentbrowse" value="">
                        <input type="hidden" name="vSelectedColumn" id="vSelectedColumn" value="">
                        <input type="hidden" name="vSelectedColumnDirection" id="vSelectedColumnDirection" value="">
                        <input type="hidden" name="hOpenSave" id="hOpenSave" value="no">
                        <input type="hidden" name="hButtonHotKeyIDs" id="hButtonHotKeyIDs" value="bCancel">
                        <input type="hidden" name="hButtonHotKeys" id="hButtonHotKeys" value="B">
                </div>
        </div>
        <input type="hidden" name="hLoadTime" id="hLoadTime" value=".113">
</form>
        
<form style="display:none;" name="navform" method="post" action="sepadm01.w"> <input type="hidden" name="nameid" id="nameid" value="-1">
        <input type="hidden" name="dwd" id="dwd" value="">
        <input type="hidden" name="wfaacl" id="wfaacl" value="">
        <input type="hidden" name="encsec" id="encsec" value="">
        <input type="hidden" name="back" id="back" value="x">
        <input type="hidden" name="entity" id="entity" value="">
        <input type="hidden" name="entities" id="entities" value="">
        <input type="hidden" name="vProgramId" id="vProgramId" value="">
        <input type="hidden" name="whereto" id="whereto" value="">
        <input type="hidden" name="Browser" id="Browser" value="Chrome">
        <input type="hidden" name="BrowserVersion" id="BrowserVersion" value="30">
        <input type="hidden" name="BrowserPlatform" id="BrowserPlatform" value="Win32">
        <input type="hidden" name="BrowserName" id="BrowserName" value="IE">
        <input type="hidden" name="TouchDevice" id="TouchDevice" value="false">
        <input type="hidden" name="HomePage" id="HomePage" value="sepadm01.w">
        <input type="hidden" name="HomePageMenuID" id="HomePageMenuID" value="">
        <input type="hidden" name="FromHomePage" id="FromHomePage" value="true">
        <input type="hidden" name="FromRecent" id="FromRecent" value="false">
        <input type="hidden" name="ButtonID" id="ButtonID" value="">
        <input type="hidden" name="RecentString" id="RecentString" value="">
</form>

<!-- Generated by Webspeed: http://www.webspeed.com/ -->

<div class="skyTipWrap" role="tooltip">
        <div class="skyTip" role="tooltip"></div>
</div>
<div class="ui-pnotify " role="status" style="width: 250px; opacity: 0.8; display: none; right: 15px; bottom: 15px;">
        <div class="ui-widget ui-widget-content ui-corner-all ui-pnotify-container ui-state-highlight" style="min-height: 16px;">
                <div class="ui-pnotify-closer" style="cursor: pointer; display: none;"> 
                        <span class="ui-icon ui-icon-circle-close"></span>
                </div>
                <div class="ui-pnotify-icon">
                        <span class="ui-icon ui-icon-info"></span>
                </div>
                <div class="ui-pnotify-title" style="display: none;"></div>
                <div class="ui-pnotify-text">Please wait...</div>
        </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
1/many:first
$("td:first");
ready
1/1:first
$("option:first")
ready
1/many.first()
$("td").first();
ready
1/1.first()
$("option").first();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Matt Ebel on
  • Revision 2: published by Matt Ebel on