diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-15 02:21:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-15 02:21:19 -0700 |
commit | f2efc0011ab229718181175a2637bbc4ce70cd0c (patch) | |
tree | 7c0c5f04fe3f5bec30c3c41399065abb39efbce7 | |
parent | 6bb5d0e8468797e057ce0f38f09338042823dd88 (diff) | |
parent | fb7772db1a952674495ebe8f43e9b983fb9d3adb (diff) | |
download | servo-f2efc0011ab229718181175a2637bbc4ce70cd0c.tar.gz servo-f2efc0011ab229718181175a2637bbc4ce70cd0c.zip |
Auto merge of #12449 - servo:jdm-patch-1, r=Ms2ger
Add a manual test for measuring DOM binding performance
This is the test harness I've been using for profiling and measuring in #12354.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12449)
<!-- Reviewable:end -->
-rw-r--r-- | tests/html/bindings_perf.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/html/bindings_perf.html b/tests/html/bindings_perf.html new file mode 100644 index 00000000000..d50cf940c32 --- /dev/null +++ b/tests/html/bindings_perf.html @@ -0,0 +1,36 @@ +<button onclick="void_method()">measure void method</button> +<button onclick="int_getter()">measure int getter</button> +<button onclick="firstChild_getter()">measure 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'); +} +</script> |