Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
jquery 1 vs 2 vs 3
(version: 0)
Comparing performance of:
jq1.12.4 vs jq2.2.4 vs jq3.4.1
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'></script> <script> var $jq1124 = $.noConflict(true); </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <script> var $jq224 = $.noConflict(true); </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> var $jq331 = $.noConflict(true); </script> <div> <ul id="menu"> <li class="menu-item">1</li> <li class="menu-item">2</li> <li class="menu-item">3</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> <li class="menu-item">4</li> </ul> </div>
Script Preparation code:
function tests($) { $(".menu-item").eq(2).closest("ul").css({ "background-color": "red" }).parent().css({ "border": "1px solid blue" }).append($("<p></p>").text("Text.").css({ "background-color": "green" })).end().end().remove(); console.log('tests' + $); }
Tests:
jq1.12.4
tests($jq1124);
jq2.2.4
tests($jq224);
jq3.4.1
tests($jq331);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
jq1.12.4
jq2.2.4
jq3.4.1
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0
Browser/OS:
Chrome 140 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
jq1.12.4
52167.2 Ops/sec
jq2.2.4
68965.0 Ops/sec
jq3.4.1
66177.2 Ops/sec
Autogenerated LLM Summary
(model
llama3.1:latest
, generated one year ago):
Let's break down the benchmark definition and explain what's being tested. **Benchmark Definition** The benchmark is called "jquery 1 vs 2 vs 3". It compares the performance of three different versions of jQuery: 1.12.4, 2.2.4, and 3.4.1. **Test Case Preparation Code** The test case preparation code is written in JavaScript. It defines a function `tests` that takes a jQuery object (`$`) as an argument. The function performs the following operations: 1. Selects the third `.menu-item` element using `$( ".menu-item" ).eq(2)`. 2. Finds the closest `ul` parent of the selected element using `closest("ul")`. 3. Styles the parent `ul` element with a red background color and a blue border using `css()`. 4. Appends a new paragraph element to the styled `ul` element, setting its text content to "Text." and styling it with a green background color. 5. Removes the styled `ul` element from the DOM using `remove()`. The code also logs a message to the console with the jQuery object (`$`) as an argument. **Individual Test Cases** There are three test cases: 1. **jq1.12.4**: Uses jQuery 1.12.4. 2. **jq2.2.4**: Uses jQuery 2.2.4. 3. **jq3.4.1**: Uses jQuery 3.4.1. **Latest Benchmark Result** The benchmark result shows the performance of each test case on a desktop Windows machine running Chrome browser. The results are measured in executions per second (EPS). **Comparison and Analysis** Based on the benchmark results, we can see that: * jQuery 2.2.4 performs slightly better than jQuery 1.12.4. * jQuery 3.4.1 performs significantly worse than both jQuery 1.12.4 and 2.2.4. This suggests that newer versions of jQuery might have performance regressions or changes in behavior that affect the execution speed. **Other Considerations** When comparing the performance of different JavaScript libraries or frameworks, it's essential to consider factors like: * Code complexity: More complex code may be slower due to increased parsing and execution overhead. * DOM manipulation: Manipulating the Document Object Model (DOM) can be expensive in terms of performance. * Library features: Using advanced library features may introduce additional overhead. **Alternative Libraries and Features** Other popular JavaScript libraries that could be compared with jQuery are: * Prototype.js * MooTools * Lodash * VanillaJS When testing JavaScript code, consider using libraries or frameworks like: * Webpack * Rollup * Babel * TypeScript
Related benchmarks:
jquery bench
jQuery versions
Jquery 1 vs 2 vs 3 vs 3Slim
jquery 1 vs 2 vs 3.6.1
JQuery Speed Testttxv
Comments
Confirm delete:
Do you really want to delete benchmark?