Skip to content

Commit

Permalink
opti: use a HashSet instead of List
Browse files Browse the repository at this point in the history
Avoid looping & Contains check.

Signed-off-by: Florian Levis <[email protected]>
  • Loading branch information
Gounlaf committed May 25, 2024
1 parent 02b4dc6 commit ac4feed
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6745,14 +6745,7 @@ static IEnumerable<string> GravityToEdge(Gravity[] edges)
}
}

var artifact = new List<string>();
foreach (var edge in GravityToEdge(edges))
{
if (!artifact.Contains(edge))
{
artifact.Add(edge);
}
}
var artifact = new HashSet<string>(GravityToEdge(edges));

using var temporaryDefines = new TemporaryDefines(this);
temporaryDefines.SetArtifact("trim:edges", string.Join(",", artifact.ToArray()));
Expand Down

0 comments on commit ac4feed

Please sign in to comment.