2009-08-26 10 views
1

Existe-t-il des différences en termes de performances entre les trois objets de bordure suivants?Performance DrawingBrush

<Border Grid.Column="0" Grid.ColumnSpan="2" Opacity="1"> 
    <Border.Background> 
    <DrawingBrush> 
     <DrawingBrush.Drawing> 
     <DrawingGroup> 
      <GeometryDrawing Brush="Red"> 
      <GeometryDrawing.Geometry> 
       <GeometryGroup> 
       <RectangleGeometry Rect="0,0 100,1000" /> 
       <LineGeometry StartPoint="0,0" EndPoint="100,1000"/> 
       <LineGeometry StartPoint="100,0" EndPoint="0,1000"/> 
       </GeometryGroup> 
      </GeometryDrawing.Geometry> 
      <GeometryDrawing.Pen> 
       <Pen Thickness="20" Brush="Black"/> 
      </GeometryDrawing.Pen> 
      </GeometryDrawing> 
     </DrawingGroup> 
     </DrawingBrush.Drawing> 
    </DrawingBrush> 
    </Border.Background> 
</Border> 

<Border Grid.Column="0" Grid.ColumnSpan="2" Opacity="1"> 
    <Border.Background> 
    <DrawingBrush> 
     <DrawingBrush.Drawing> 
     <DrawingGroup> 
      <GeometryDrawing Brush="Red"> 
      <GeometryDrawing.Geometry> 
       <RectangleGeometry Rect="0,0 100,1000" /> 
      </GeometryDrawing.Geometry> 
      <GeometryDrawing.Pen> 
       <Pen Thickness="20" Brush="Black"/> 
      </GeometryDrawing.Pen> 
      </GeometryDrawing> 
      <GeometryDrawing> 
      <GeometryDrawing.Geometry> 
       <LineGeometry StartPoint="0,0" EndPoint="100,1000"/> 
      </GeometryDrawing.Geometry> 
      <GeometryDrawing.Pen> 
       <Pen Thickness="20" Brush="Black"/> 
      </GeometryDrawing.Pen> 
      </GeometryDrawing> 
      <GeometryDrawing> 
      <GeometryDrawing.Geometry> 
       <LineGeometry StartPoint="100,0" EndPoint="0,1000"/> 
      </GeometryDrawing.Geometry> 
      <GeometryDrawing.Pen> 
       <Pen Thickness="20" Brush="Black"/> 
      </GeometryDrawing.Pen> 
      </GeometryDrawing> 
     </DrawingGroup> 
     </DrawingBrush.Drawing> 
    </DrawingBrush> 
    </Border.Background> 
</Border> 

<Border Grid.Column="3" Grid.ColumnSpan="2" Opacity="1"> 
    <Image Stretch="Uniform"> 
    <Image.Source> 
     <DrawingImage> 
     <DrawingImage.Drawing> 
      <DrawingGroup> 
      <GeometryDrawing Brush="Red"> 
       <GeometryDrawing.Geometry> 
       <GeometryGroup> 
        <RectangleGeometry Rect="0,0 100,1000" /> 
        <LineGeometry StartPoint="0,0" EndPoint="100,1000"/> 
        <LineGeometry StartPoint="100,0" EndPoint="0,1000"/> 
       </GeometryGroup> 
       </GeometryDrawing.Geometry> 
       <GeometryDrawing.Pen> 
       <Pen Thickness="20" Brush="Black"/> 
       </GeometryDrawing.Pen> 
      </GeometryDrawing> 
      </DrawingGroup> 
     </DrawingImage.Drawing> 
     </DrawingImage> 
    </Image.Source> 
    </Image> 
</Border> 

Répondre

4

est ici la réponse standard pour des questions telles que la vôtre qui bouillent à 'est plus rapide que B? Essayez les deux (ou tous les trois ou plusieurs) et mesurez les temps d'exécution. Les arguments des premiers principes ne répondront pas à la question, bien qu'ils puissent générer beaucoup d'air chaud. S'il vous plaît ne pensez pas que je vous brosse une réponse désinvolte, où je travaille en ce moment, l'informatique parallèle pour la géophysique, la performance est très très important. L'expérience durement acquise me dit que la seule façon d'être certain que A est plus rapide que B est de mesurer les deux. Et si cela ne vaut pas la peine de coder les deux pour mesurer les différences, alors la différence n'est pas importante!