title: which flood-fill algorithm is better for performance?
body: <p>i'm trying to implement an algorithm which is flood-fill alike. the problem is that i'm not sure in what way i should implement it e.g recursive - non-recursive.<br>
  i know that each has its defects but one of them must be faster than the other one. the recursive opens new function on the stack when the non-recursive allocates 4 new points each time.<br>
  example for the non-iterative :</p>
  
  <pre><code>Stack&lt;Point&gt; stack = new Stack&lt;Point&gt;();
      stack.Push(q);
      while (stack.Count &gt; 0)
      {
          Point p = stack.Pop();
          int x = p.X;
          int y = p.Y;
          if (y &lt; 0 || y &gt; h - 1 || x &lt; 0 || x &gt; w - 1)
                  continue;
          byte val = vals[y, x];
          if (val == SEED_COLOR)
          {
                  vals[y, x] = COLOR;
                  stack.Push(new Point(x + 1, y));
                  stack.Push(new Point(x - 1, y));
                  stack.Push(new Point(x, y + 1));
                  stack.Push(new Point(x, y - 1));
          }
      }
  </code></pre>
  
  <p>edit : im going to apply the following algorithm on a 600X600 pixels map. though the floodfill isn't going to be applied on the entire map, it should cover about 30% - 80% of the map each iteration. my point is to discover edges in a height map and mark those edges for a further use.</p>