Files
tubestation/servo/tests/html/bindings_perf.html
Josh Matthews 767d747f71 servo: Merge #12980 - Fix ridiculous DOM proxy getter performance (from jdm:proxychanges); r=nox
This implements the missing shadowing checks that were causing us to take many slow paths when dealing with proxy objects. Verified by running `tests/html/binding_perf.html` before and after and observing a 12x improvement.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12357
- [X] These changes do not require tests because we can't test performance yet.

Source-Repo: https://github.com/servo/servo
Source-Revision: 78344754826e938c004a83a21c898552a8e77b17
2016-08-25 06:31:46 -05:00

49 lines
1.4 KiB
HTML

<button onclick="void_method()">measure void method</button>
<button onclick="int_getter()">measure int getter</button>
<button onclick="firstChild_getter()">measure firstChild getter</button>
<button onclick="proxy_firstChild_getter()">measure proxy firstChild getter</button>
<script>
var t = 'TestBinding' in window ? (new TestBinding()) : (new TextEncoder());
function void_method() {
var start = new Date();
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = t.receiveVoid();
}
var stop = new Date();
console.log('void method: ' + ((stop - start) / count * 1e6) + 'ns');
}
function int_getter() {
var start = new Date();
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = t.longAttribute;
}
var stop = new Date();
console.log('int getter: ' + ((stop - start) / count * 1e6) + 'ns');
}
function firstChild_getter() {
var n = document.documentElement;
var start = new Date();
var count = 100000000;
for (var i = 0; i < count; i++) {
var a = n.firstChild;
}
var stop = new Date();
console.log('firstChild getter: ' + ((stop - start) / count * 1e6) + 'ns');
}
function proxy_firstChild_getter() {
var n = document;
var start = new Date();
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = n.firstChild;
}
var stop = new Date();
console.log('proxy firstChild getter: ' + ((stop - start) / count * 1e6) + 'ns');
}
</script>