Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Observed values
(version: 0)
Comparing performance of:
Vanilla stay same vs Vanilla change vs Observed stay same vs Observed change
Created:
5 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="foo"></div>
Script Preparation code:
var element = document.getElementById("foo"); class Observed { constructor(onChange) { this._onChange = onChange; } get value() { return this._val; } set value(val) { if (this._val !== val) { this._val = val; this._onChange(this._val); } } } var obs = new Observed(async val => { element.setAttribute("visibility", "hidden"); }); obs.value = 5; var val = 5;
Tests:
Vanilla stay same
val = val; element.setAttribute("visibility", "hidden");
Vanilla change
val++; element.setAttribute("visibility", "hidden");
Observed stay same
obs.value = obs.value;
Observed change
obs.value++;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Vanilla stay same
Vanilla change
Observed stay same
Observed change
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!
Related benchmarks:
className vs. setAttribute data attribute vs. classList
className vs. setAttribute vs. classList v2
Observable values
Cost of adding and removing events
Comments
Confirm delete:
Do you really want to delete benchmark?