title: runtime optimization of a matching algorithm
body: <p>I made the following matching algorithm, but of course i will having big runtimes...</p>
  
  <p>Has anybody an idea to make this matching faster (by changing the code or changing the algorithm)</p>
  
  <pre><code>for (i=0;i&lt;AnzEntity;i++){
    for (j=0;j&lt;8;j++){
      if (Entity[i].GID[j] &gt; 0){
        for (k=0;k&lt;AnzGrid;k++){
          if (Entity[i].Module == Grid[k].Module &amp;&amp; Entity[i].GID[j] == Grid[k].ID ){
            Entity[i].GIDCoord[j][0] = Grid[k].XYZ[0];
            Entity[i].GIDCoord[j][1] = Grid[k].XYZ[1];
            Entity[i].GIDCoord[j][2] = Grid[k].XYZ[2];
            continue;
          }
        }
      }    
    }
  }
  </code></pre>