lkang2 / glmatrix

Automatically exported from code.google.com/p/glmatrix
0 stars 0 forks source link

Use ![var] instead of [var]==0 #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It is not exactly the same but it is faster.

Microbenchmark:

<html>
<script type="text/javascript">
var a = 0;

var d=new Date();
for(var x = 0; x < 10000000; x++) {
    if (!a){}
}
var e = new Date() -d;
var f=new Date();
for(var b = 0; b < 10000000; b++) {
    if (a==0){}
}
var g = new Date() -d;
alert(e);
alert(g);
</script>
</html>

Original issue reported on code.google.com by danielhe...@gmail.com on 5 Jun 2010 at 10:33

GoogleCodeExporter commented 8 years ago

Original comment by Tojiro@gmail.com on 12 Jun 2010 at 5:19

GoogleCodeExporter commented 8 years ago

Original comment by Tojiro@gmail.com on 12 Jun 2010 at 5:31

GoogleCodeExporter commented 8 years ago

Original comment by Tojiro@gmail.com on 13 Jun 2010 at 4:13

GoogleCodeExporter commented 8 years ago
Still here:
941        if(len == 0) {

Original comment by danielhe...@gmail.com on 14 Jun 2010 at 7:55