Hacker News new | ask | show | jobs
by carlopi 1617 days ago
Pure JS unrolling + bit manipulations lead to roughly 40% speed up, using this function:

  function add() {
    var i = 0, d0 = 0.0, d1 = 0.0, d2=0.0, d3=0.0;
    for (i = 0|0; i < N; i = ((i|0)+(4|0))|0) {
      d0 = a[i^0] + b[i^0];
      d1 = a[i^1] + b[i^1];
      d2 = a[i^2] + b[i^2];
      d3 = a[i^3] + b[i^3];
      c[i^0] = d0;
      c[i^1] = d1;
      c[i^2] = d2;
      c[i^3] = d3;
    }
  }
Could you try it & possibly adding this (possibly instead of the slower unrolling options?)