mirror of https://github.com/SixLabors/ImageSharp
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.
36 lines
1.1 KiB
36 lines
1.1 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Drawing.Imaging;
|
|
using BenchmarkDotNet.Attributes;
|
|
using SixLabors.ImageSharp.Formats.Bmp;
|
|
|
|
namespace SixLabors.ImageSharp.Benchmarks.Codecs
|
|
{
|
|
[Config(typeof(Config.ShortClr))]
|
|
public class EncodeBmpMultiple : MultiImageBenchmarkBase.WithImagesPreloaded
|
|
{
|
|
protected override IEnumerable<string> InputImageSubfoldersOrFiles => new[] { "Bmp/", "Jpg/baseline" };
|
|
|
|
[Benchmark(Description = "EncodeBmpMultiple - ImageSharp")]
|
|
public void EncodeBmpImageSharp()
|
|
{
|
|
this.ForEachImageSharpImage((img, ms) =>
|
|
{
|
|
img.Save(ms, new BmpEncoder());
|
|
return null;
|
|
});
|
|
}
|
|
|
|
[Benchmark(Baseline = true, Description = "EncodeBmpMultiple - System.Drawing")]
|
|
public void EncodeBmpSystemDrawing()
|
|
{
|
|
this.ForEachSystemDrawingImage((img, ms) =>
|
|
{
|
|
img.Save(ms, ImageFormat.Bmp);
|
|
return null;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|