Multiply vs divide / constant vs vars
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var counter = 0,
m1 = 0.25, m2 = 0.5, m3 = 0.1, m4 = 2,
d1 = 4, d2 = 2, d3 = 10, d4 = 0.5;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Dummy - ignore? |
|
pending… |
Multiply by Const |
|
pending… |
Multiply by Var |
|
pending… |
Divide by Const |
|
pending… |
Divide by Var |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published
- Revision 3: published
- Revision 5: published
- Revision 7: published by Leo Berdu
- Revision 8: published
- Revision 9: published
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 14: published
0 comments