📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.6 KiB

namespace ImageSharp.Benchmarks.Image
{
using System.Collections.Generic;
using System.Drawing.Imaging;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using ImageSharp.Formats;
[Config(typeof(SingleRunConfig))]
public class EncodeGifMultiple : MultiImageBenchmarkBase.WithImagesPreloaded
{
public class SingleRunConfig : Config
{
public SingleRunConfig()
{
this.Add(
Job.Default.WithLaunchCount(1)
.WithWarmupCount(1)
.WithTargetCount(1)
);
}
}
[Params(InputImageCategory.AllImages)]
public override InputImageCategory InputCategory { get; set; }
protected override IEnumerable<string> InputImageSubfoldersOrFiles => new[] { "Gif/" };
[Benchmark(Description = "EncodeGifMultiple - ImageSharp")]
public void EncodeGifImageSharp()
{
this.ForEachImageSharpImage(
(img, ms) =>
{
img.Save(ms, new GifEncoder());
return null;
});
}
[Benchmark(Baseline = true, Description = "EncodeGifMultiple - System.Drawing")]
public void EncodeGifSystemDrawing()
{
this.ForEachSystemDrawingImage(
(img, ms) =>
{
img.Save(ms, ImageFormat.Gif);
return null;
});
}
}
}