Negativing a positive integer
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var int = 200;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
string based |
|
pending… |
Multiplication |
|
pending… |
Silly but i wondered on how bad it would be... |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
1 comment
Well that was surprising (for me at least). The one i thought was silly (minusing by a double of the same number) turned out to be just as quick.
Obviously the type casting in the first one is taking it's toll.