-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(bench): Multiline bench improved, DashedLine bench
- Loading branch information
1 parent
a30d278
commit 434f435
Showing
3 changed files
with
52 additions
and
67 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/quality/GodotSharpSome.Drawing2D.Benchmarks/DashedLineBenchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Godot; | ||
|
||
namespace GodotSharpSome.Drawing2D.Benchmarks; | ||
|
||
[MemoryDiagnoser] | ||
public class DashedLineBenchmark | ||
{ | ||
private readonly List<Vector2> _points = new(100); | ||
private readonly DashedLine _dashedLine = new(); | ||
|
||
[Benchmark] | ||
public DashedLine CreateDefault() | ||
{ | ||
return new DashedLine(); | ||
} | ||
|
||
[Benchmark] | ||
public DashedLine CreateCustom() | ||
{ | ||
return new DashedLine(5.5f, 4f); | ||
} | ||
|
||
[Benchmark] | ||
public void CreateDefaultWithListAndPalette() | ||
{ | ||
_points.Clear(); | ||
_dashedLine.AppendLine(_points, Vector2.Zero, new (0, 100)); | ||
} | ||
|
||
[Benchmark] | ||
public void CreateDefaultFourLineTypes() | ||
{ | ||
_points.Clear(); | ||
DashedLine.AppendLine(_points, Vector2.Zero, new(0, 100), 12, 8); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters