Last active
August 18, 2017 11:31
-
-
Save marekpiechut/96babe8b971284f62f597cd7d7391b10 to your computer and use it in GitHub Desktop.
Benchmark proto - small
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const MyType = function(startVal) { | |
| this.val = startVal | |
| ... | |
| } | |
| MyType.prototype.add = function(b) { ... } | |
| MyType.prototype.sub = function(b) { ... } | |
| ... | |
| for(let i = 0; i < 1000000; i++) { | |
| objects.push(new MyType(i)) | |
| } | |
| let idx = 0 | |
| setInterval(() => { | |
| const o = objects[idx] | |
| o.add(12) | |
| o.sub(4) | |
| o.mul(7) | |
| o.mod(16) | |
| idx++ | |
| document.getElementById('target-div').innerHTML = o.getVal() | |
| }, 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment