JonazMartinez / explorercanvas

Automatically exported from code.google.com/p/explorercanvas
Apache License 2.0
0 stars 0 forks source link

A few speed optimizations #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, I'm using ExCanvas everyday in my projects and think a few things
could be optimized.

The first is general : in every for loop, the array.length should be
de-referenced, for example :

for (var i = 0; i < this.currentPath_.length; i++) {

should become

var path = this.currentPath_,
    length = path.length;
for (var i = 0; i < length; i++) {

Another change could be the matrixIsFinite function, that could become :

  function matrixIsFinite(m) {
    return (
      isFinite(m[0][0]) && isFinite(m[0][1]) && 
      isFinite(m[1][0]) && isFinite(m[1][1]) && 
      isFinite(m[2][0]) && isFinite(m[2][1])
    );
  }

The actual one uses variables that could be avoided and I think the
isFinite function includes the isNaN function, correct me if I'm wrong.

Another I wanted to tell you is that when we use code compressors like Dean
Edwards' packer, there are a few syntax errors, there are missing
semi-colons after a few function and object declarations. I think this
should be fixed too.

Original issue reported on code.google.com by fabien.menager on 7 Apr 2009 at 1:28

GoogleCodeExporter commented 9 years ago

Original comment by erik.arv...@gmail.com on 19 Apr 2009 at 7:18

GoogleCodeExporter commented 9 years ago

Original comment by erik.arv...@gmail.com on 25 Apr 2009 at 10:23