Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
jQuery width vs computed style
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0
Browser:
Firefox 122
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
jquery
381924.7 Ops/sec
native
1791072.4 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js'></script> <style> #wrap { width:5rem; height: 3rem; margin:10px; padding:10px; border:10px solid black; } </style> <div id="wrap1"> </div>
Script Preparation code:
var $div = $("#wrap1"); var div = document.getElementById("wrap1");
Tests:
jquery
const width = $div.width();
native
const width = parseInt(getComputedStyle(div, '').width);