Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
window.getComputedStyle WebKitCSSMatrix vs getAttribute
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
getAttribute
3K/s
getComputedStyle
152/s
View exact numbers
Test name
Executions per second
✓
getAttribute
3,105 Ops/sec
getComputedStyle
152 Ops/sec
HTML Preparation code:
<div id="foo" data-attr="foo" style="transform: translate3d(0, -350px, 0)"></div>
Tests:
getComputedStyle
var i = 3000; while (i--) { chekele('foo'); } function chekele(element) { var tr = window.getComputedStyle(document.getElementById(element), null).getPropertyValue("transform"); return matrix = new WebKitCSSMatrix(tr); }
getAttribute
var i = 3000; while (i--) { chekele('foo'); } function chekele(element) { return document.getElementById(element).getAttribute('data-attr'); }