title: WPF PathGeometry/RotateTransform optimization
body: <p>I am having performance issues when rendering/rotating WPF triangles</p>
  
  <p>If I had a WPF triangle being displayed and it will be rotated to some degree around a centrepoint, I can do it one of two ways:</p>
  
  <ol>
  <li><p>Programatically determine the points and their offset in the backend, use XAML to simply place them on the canvas where they belong, it would look like this:</p>
  
  <pre><code>&lt;Path Stroke="Black"&gt;
     &lt;Path.Data&gt;
        &lt;PathGeometry&gt;
           &lt;PathFigure StartPoint ="{Binding CalculatedPointA, Mode=OneWay}"&gt;
              &lt;LineSegment Point="{Binding CalculatedPointB, Mode=OneWay}" /&gt;
              &lt;LineSegment Point="{Binding CalculatedPointC, Mode=OneWay}" /&gt;
              &lt;LineSegment Point="{Binding CalculatedPointA, Mode=OneWay}" /&gt;
           &lt;/PathFigure&gt;
        &lt;/PathGeometry&gt;
     &lt;/Path.Data&gt;
  &lt;/Path&gt;
  </code></pre></li>
  <li><p>Generate the 'same' triangle every time, and then use a RenderTransform (Rotate) to put it where it belongs. In this case, the rotation calculations are being obfuscated, because I don't have any access to how they are being done.</p>
  
  <pre><code>&lt;Path Stroke="Black"&gt;
     &lt;Path.Data&gt;
        &lt;PathGeometry&gt;
           &lt;PathFigure StartPoint ="{Binding TriPointA, Mode=OneWay}"&gt;
              &lt;LineSegment Point="{Binding TriPointB, Mode=OneWay}" /&gt;
              &lt;LineSegment Point="{Binding TriPointC, Mode=OneWay}" /&gt;
              &lt;LineSegment Point="{Binding TriPointA, Mode=OneWay}" /&gt;
           &lt;/PathFigure&gt;
        &lt;/PathGeometry&gt;
     &lt;/Path.Data&gt;
     &lt;Path.RenderTransform&gt;
        &lt;RotateTransform CenterX="{Binding Centre.X, Mode=OneWay}" 
                         CenterY="{Binding Centre.Y, Mode=OneWay}"
                         Angle="{Binding Orientation, Mode=OneWay}" /&gt;
     &lt;/Path.RenderTransform&gt;
  &lt;/Path&gt;
  </code></pre></li>
  </ol>
  
  <p>My question is which one is faster?</p>
  
  <p>I know I should test it myself but how do I measure the render time of objects with such granularity. I would need to be able to time how long the actual rendering time is for the form, but since I'm not the one that's kicking off the redraw, I don't know how to capture the start time.</p>