Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
jQuery text() vs html()
(version: 0)
Comparing performance of:
text() vs html()
Created:
7 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js'></script> <div id="body"> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/"><i class="fa fa-bar-chart" aria-hidden="true"></i> MeasureThat.net<sup>beta</sup></a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="/Benchmarks/Add">Create</a></li> <li><a href="/blog/index.html">Blog<sup>new</sup></a></li> <li><a data-toggle="modal" data-target="#aboutModal" href="#">About</a></li> <li><a href="/Home/Discussions">Suggestions & Feedback</a></li> <li><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&no_note=0&lc=US¤cy_code=USD&bn=PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest&business=MeasureThat@outlook.com&item_name=MeasureThat&item_number=Support%20service&amount=0"><img src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" alt="PayPal — The safer, easier way to pay online." /></a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="/Account/Register">Register</a></li> <li><a href="#" data-toggle="modal" data-target="#authenticateModal">Log in</a></li> </ul> </div> </div> </div> <div class="container body-content"> <div class="row"> <div class="jumbotron"> <h1>MeasureThat.net <i class="fa fa-bar-chart" aria-hidden="true"></i></h1> <p class="lead">MeasureThat.net is the website to create and run JavaScript benchmarks. It uses <a target="_blank" href="https://benchmarkjs.com/">BenchmarkJS (v.2.1.1)</a> as a test runner.</p> <p>Click <strong>Create Benchmark</strong> to get started</p> <p> <a class="btn btn-primary btn-lg" href="/Benchmarks/Add"><i class="fa fa-plus" aria-hidden="true"></i> Create benchmark</a> <a class="btn btn-default btn-lg" href="/Benchmarks">Latest benchmarks</a> <a class="btn btn-default btn-lg" href="/Benchmarks/My">Your benchmarks</a> </p> </div> <div class="col-md-4"> <h2>Help to improve this website</h2> <p>Please report any issues or make suggestions on the projec'ts GitHub page. Also feel free to join development effort, source code available on GitHub.</p> <p><a target="_blank" class="btn btn-default" href="https://github.com/thecoderok/MeasureThat.net">GitHub/MeasureThat.net »</a></p> </div> <div class="col-md-4"> <h2>Open Source & Cross platform</h2> <p>This website was built using Microsoft .Net Core and can be ran & developed on Windows/Linux/Mac. (instructions about how to get started in building and running it locally will be posted later)</p> <p><a target="_blank" href="http://the-coderok.azurewebsites.net/2016/10/11/Run-MeasureThat-net-application-on-Linux-building-and-running-the-application/">How to run the application on Linux using PostgreSQL as a database</a></p> </div> <div class="col-md-4"> <h2>Sample benchmarks:</h2> <ul> <li> <a href="https://www.measurethat.net/Benchmarks/Show/373/0/empty-an-array-in-javascript">Clear the array</a> </li> <li> <a href="https://www.measurethat.net/Benchmarks/Show/1/demo-benchmark">Demo benchmark (example from benchmarkjs.com)</a> </li> <li> <a href="https://www.measurethat.net/Benchmarks/Show/2/caching-length-property-vs-getting-it-each-ti">Caching length property vs getting it each time in the loop</a> </li> <li> <a href="https://www.measurethat.net/Benchmarks/Show/3/jquery-by-id-vs-documentgetelementbyid">jQuery by id vs Document.getElementById</a> </li> <li> <a href="https://www.measurethat.net/Benchmarks/Show/4/ecmascript6-int16array-vs-regular-js-array">EcmaScript6 Int16Array vs regular JS array</a> </li> <li> <a href="https://www.measurethat.net/Benchmarks/Show/19/0/which-equals-operator-vs-is-faster">Which equals operator (== vs ===) is faster?</a> </li> </ul> </div> <hr /> <br> <div class="col-md-6"> <br> <p style="display:none;" id="github_buttons"> <a class="github-button" href="https://github.com/thecoderok" data-count-href="/thecoderok/followers" data-count-api="/users/thecoderok#followers" data-count-aria-label="# followers on GitHub" aria-label="Follow @thecoderok on GitHub">Follow @thecoderok</a> <a class="github-button" href="https://github.com/thecoderok/MeasureThat.net/fork" data-icon="octicon-repo-forked" data-count-href="/thecoderok/MeasureThat.net/network" data-count-api="/repos/thecoderok/MeasureThat.net#forks_count" data-count-aria-label="# forks on GitHub" aria-label="Fork thecoderok/MeasureThat.net on GitHub">Fork</a> <a class="github-button" href="https://github.com/thecoderok/MeasureThat.net" data-icon="octicon-star" data-count-href="/thecoderok/MeasureThat.net/stargazers" data-count-api="/repos/thecoderok/MeasureThat.net#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star thecoderok/MeasureThat.net on GitHub">Star</a> <a class="github-button" href="https://github.com/thecoderok/MeasureThat.net/issues" data-icon="octicon-issue-opened" data-count-api="/repos/thecoderok/MeasureThat.net#open_issues_count" data-count-aria-label="# issues on GitHub" aria-label="Issue thecoderok/MeasureThat.net on GitHub">Issue</a> </p> <p> <div class="fb-like" data-href="https://measurethat.net/" data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div> </p> <div class="fb-page" data-href="https://www.facebook.com/MeasureThat.Net/" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><blockquote cite="https://www.facebook.com/MeasureThat.Net/" class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/MeasureThat.Net/">MeasureThat.net</a></blockquote></div> </div> <div class="col-md-6"> <h2>Change log:</h2> <h3>v1.0.48.0 (12/20/2017)</h3> <ul> <li> Release after long pause </li> <li> Improved performance </li> <li> Better pagination </li> </ul> <h3>v1.0.41.0 (9/9/2016)</h3> <ul> <li> Support local accounts (in addition to OpenId providers) (<a href="https://github.com/thecoderok/MeasureThat.net/issues/37" target="_blank">#37</a>) </li> <li> Multiple bug fixes. </li> </ul> <h3>v1.0.38.0 (9/7/2016)</h3> <ul> <li> Show info to the user that benchmark will be posted as guest and unable to edit (<a href="https://github.com/thecoderok/MeasureThat.net/issues/45" target="_blank">#45</a>) </li> <li> Edit button for the owner on the Show page (<a href="https://github.com/thecoderok/MeasureThat.net/issues/46" target="_blank">#46</a>) </li> <li> Fix alignment of the latest benchmarks & history sections on the home page bug (<a href="https://github.com/thecoderok/MeasureThat.net/issues/48" target="_blank">#48</a>) </li> <li> Use correct benchmark version when saving result bug (<a href="https://github.com/thecoderok/MeasureThat.net/issues/44" target="_blank">#44</a>) </li> </ul> <h3>v1.0.36.0 (9/2/2016)</h3> <ul> <li> Fixed bug with 404 error which made adding new benchmarks impossible (lesson learned: do not make late night deployment when tired :( )) </li> </ul> <h3>v1.0.34.0 (9/2/2016)</h3> <ul> <li> Ability to edit own benchmarks (user must be authenticated) </li> </ul> <br> <h3>v1.0.33.0 (9/1/2016)</h3> <ul> <li> Authentication not needed to create benchmarks </li> <li> Fixed bug when test case parsing (Server was unable to read input provided by user when user delted some test case.) </li> <li> "My" benchmarks now ordered by date when they were created. </li> </ul> </div> <div id="fb-root"></div> <!--GitHub stuff--> <!--<a target="_blank" href="https://github.com/thecoderok/MeasureThat.net"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 1500;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>--> </div> <hr /> <footer> <p>© 2018 - MeasureThat.net (Version: 1.2.55.0)</p> <div id="ads"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- measurethat.net --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2889218219879125" data-ad-slot="5761409685" data-ad-format="auto"></ins> </div> </footer> </div> <div class="modal fade" id="aboutModal" tabindex="-1" role="dialog" aria-labelledby="myModal-label" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModal-label">About</h4> </div> <div class="modal-body"> <h2>JavaScript performance benchmarks</h2> <p><b>Source code:</b> <a target="_blank" href="https://github.com/thecoderok/MeasureThat.net">GitHub/MeasureThat.net</a></p> <p><b>Report issues:</b> <a target="_blank" href="https://github.com/thecoderok/MeasureThat.net/issues">MeasureThat.net/Issues</a> <p><b>Based on:</b> <a target="_blank" href="https://benchmarkjs.com/">Benchmark.js (v2.1.1)</a> <p> <b>Facebook page:</b> <a target="_blank" href="https://www.facebook.com/MeasureThat.Net">https://www.facebook.com/MeasureThat.Net</a> </p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="modal fade" id="authenticateModal" tabindex="-1" role="dialog" aria-labelledby="authenticateModal-label" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="authenticateModal-label">Log in using external service:</h4> </div> <div class="modal-body" style="text-align: center"> <section> <form method="post" class="form-horizontal" action="/Account/ExternalLogin"> <div> <p> <button type="submit" class="btn btn-default" name="provider" value="Facebook" title="Log in using your Facebook account"> <i class="fa fa-facebook fa-4x" aria-hidden="true"></i> <br> Facebook </button> <button type="submit" class="btn btn-default" name="provider" value="Twitter" title="Log in using your Twitter account"> <i class="fa fa-twitter fa-4x" aria-hidden="true"></i> <br> Twitter </button> <button type="submit" class="btn btn-default" name="provider" value="Google" title="Log in using your Google account"> <i class="fa fa-google fa-4x" aria-hidden="true"></i> <br> Google </button> </p> </div> <input name="__RequestVerificationToken" type="hidden" value="CfDJ8HWN38AjWUBAkR_eDVYrfCVQuHWf5t5jyRG6vSSjq_LoKfWFEYZvjp0oEERebN-Y4m5-RKqnGqiH1GmrjB6sFE4Msu-F6TFavf3zkdy0rZY645-EGbcV_5sjlQ1MhOEJ26OnnMTEZ3QFXnziwjHShvo" /></form> </section> <section> Or <a class="btn btn-primary" href="/Account/Login">Sign in with local account</a> </section> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div> </div> </div> </div>
Script Preparation code:
var body = $('#body');
Tests:
text()
var text = body.text();
html()
var html = body.html();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
text()
html()
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
It appears to be an ASP.NET web page with a modal dialog box containing a form for logging in using external services (Facebook, Twitter, or Google). The page also contains two benchmarking tests: one for the `text()` method and another for the `html()` method. The latest benchmark result shows that: * For the `text()` test, Chrome 69 on Windows has an execution rate of approximately 38190 executions per second. * For the `html()` test, Chrome 69 on Windows has an execution rate of approximately 7107 executions per second. These results suggest that the `text()` method is significantly faster than the `html()` method, with a speed ratio of around 5:1.
Related benchmarks:
ID vs CLASS vs ID CLASS vs CLASS > CLASS vs DATA
querySelector vs getElementsByClassName - large HTML
data vs class
TreeWalker vs querySelectorAll (* all elements) 2
Comments
Confirm delete:
Do you really want to delete benchmark?