title: EndDraw() takes 80 % of working time in Direct2D
body: <p>I face one critical Performance problem in my Direct2D application. I make use of Direct2D to draw my graph using PathGeometry to get better performance and to achieve the clean rendering in Windows 8.1.</p>
  
  <p>While creating the DeviceResources, i create the PathGeometry using the Factory interface. Then i set the Graph points to draw my graph in the output surface. Finally rendered ImageSource will be used as the source for my Image element in the XAML.</p>
  
  <p>I just followed the below sample link to achieve my scenario.</p>
  
  <p><a href="http://code.msdn.microsoft.com/windowsapps/XAML-SurfaceImageSource-58f7e4d5" rel="nofollow noreferrer">http://code.msdn.microsoft.com/windowsapps/XAML-SurfaceImageSource-58f7e4d5</a></p>
  
  <p>The above sample helped me a lot to get the ImageSource output from the Direct2D and finally used across the XAML/C# app. </p>
  
  <p>Lets come to my problem. I use more than 24 graphs in the single Page of my Windows Store application. This graph allows the user to manipulate in Left and Right position and also allows to scale to the particular zoom level.</p>
  
  <p>Hence whenever user tries to manipulate the graph , i just set the Translation and Scaling matrix to the TransformedPathGeometry instead of creating the new one for each and every time.</p>
  
  <pre><code>ID2D1TransformedGeometry *m_pTransformedGeometry;
  
  pFactory-&gt;CreateTransformedGeometry(graphgeometry, combinedMatrix, &amp;m_pTransformedGeometry);
  </code></pre>
  
  <p>Finally i draw the TransformedGeometry using the DrawGeometry method.</p>
  
  <p>I checked my application using the Performance analysis tool in the VisualStudio2013. I could see that in the particular peek level, It takes more than 80% of running time to call the m_d2deviceContext->EndDraw() method. I attached the below screen shot to get more idea in this performance output.</p>
  
  <p>Is there any way to <strong>increase this performance</strong> considerably ?</p>
  
  <p><img src="https://i.stack.imgur.com/Ub0Qk.png" alt="enter image description here"></p>
  
  <p>Could you please anyone help me in this ?</p>
  
  <p>Regards,
  David C</p>