diff --git a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
index c942bbd34..01a6d07d5 100644
--- a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
+++ b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
@@ -9,7 +9,8 @@
Image Draw Shape Path Font
SixLabors.ImageSharp.Drawing
- netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472
+
+ netcoreapp3.1
diff --git a/tests/ImageSharp.Drawing.Benchmarks/Drawing/DrawLongText.cs b/tests/ImageSharp.Drawing.Benchmarks/Drawing/DrawLongText.cs
new file mode 100644
index 000000000..afdf3ab2f
--- /dev/null
+++ b/tests/ImageSharp.Drawing.Benchmarks/Drawing/DrawLongText.cs
@@ -0,0 +1,96 @@
+using System.Drawing;
+using System.Text;
+using BenchmarkDotNet.Attributes;
+using SixLabors.ImageSharp.Drawing.Processing;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using Font = SixLabors.Fonts.Font;
+using SDBitmap = System.Drawing.Bitmap;
+using SDGraphics = System.Drawing.Graphics;
+using SDFont = System.Drawing.Font;
+using SDPixelFormat = System.Drawing.Imaging.PixelFormat;
+using SDRectangleF = System.Drawing.RectangleF;
+using SystemFonts = SixLabors.Fonts.SystemFonts;
+
+namespace SixLabors.ImageSharp.Drawing.Benchmarks
+{
+ public class DrawLongText
+ {
+ private Image imageSharpImage;
+ private SDBitmap sdBitmap;
+ private string text;
+ private Font font;
+ private SDFont sdFont;
+
+ public const int Width = 1300;
+ public const int Height = 1300;
+ public const int Rows = 20;
+ public const int Cols = 36;
+
+ [GlobalSetup]
+ public void Setup()
+ {
+ this.text = CreateText(Rows, Cols);
+ this.imageSharpImage = new Image(Width, Height, Color.Black.ToPixel());
+ this.font = SystemFonts.CreateFont("Arial", 50);
+
+ this.sdBitmap = new SDBitmap(Width, Height, SDPixelFormat.Format32bppArgb);
+ this.sdFont = new SDFont("Arial", 12, System.Drawing.GraphicsUnit.Point);
+ }
+
+ [GlobalCleanup]
+ public void Cleanup()
+ {
+ this.sdFont.Dispose();
+ this.imageSharpImage.Dispose();
+ this.sdBitmap.Dispose();
+ }
+
+ [Benchmark]
+ public void ImageSharp()
+ {
+ this.imageSharpImage.Mutate(ctx => ctx.DrawText(this.text, this.font, Color.White, default));
+ }
+
+ [Benchmark(Baseline = true)]
+ public void SystemDrawing()
+ {
+ using SDGraphics graphics = SDGraphics.FromImage(this.sdBitmap);
+ graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
+ graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
+
+ SDRectangleF rect = new SDRectangleF(0, 0, Width, Height);
+ graphics.DrawString(
+ this.text,
+ this.sdFont,
+ System.Drawing.Brushes.HotPink,
+ rect);
+ }
+
+ private static string CreateText(int rows, int cols)
+ {
+ StringBuilder bld = new StringBuilder();
+ const char firstChar = '!';
+ const char lastChar = 'z';
+
+ int currentChar = firstChar;
+ for (int i = 0; i < rows; i++)
+ {
+ for (int j = 0; j < cols; j++)
+ {
+ bld.Append((char)currentChar);
+ currentChar++;
+ if (currentChar > lastChar)
+ {
+ currentChar = firstChar;
+ }
+ }
+
+ bld.AppendLine();
+ }
+
+ string text = bld.ToString();
+ return text;
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Drawing.Benchmarks/ImageSharp.Drawing.Benchmarks.csproj b/tests/ImageSharp.Drawing.Benchmarks/ImageSharp.Drawing.Benchmarks.csproj
index fe40cdbf2..f8b18f0ce 100644
--- a/tests/ImageSharp.Drawing.Benchmarks/ImageSharp.Drawing.Benchmarks.csproj
+++ b/tests/ImageSharp.Drawing.Benchmarks/ImageSharp.Drawing.Benchmarks.csproj
@@ -3,7 +3,8 @@
Exe
SixLabors.ImageSharp.Drawing.Benchmarks
- netcoreapp3.1;netcoreapp2.1;net472
+
+ netcoreapp3.1
false
false
diff --git a/tests/ImageSharp.Drawing.Tests/ImageSharp.Drawing.Tests.csproj b/tests/ImageSharp.Drawing.Tests/ImageSharp.Drawing.Tests.csproj
index 66732cca2..54199bb29 100644
--- a/tests/ImageSharp.Drawing.Tests/ImageSharp.Drawing.Tests.csproj
+++ b/tests/ImageSharp.Drawing.Tests/ImageSharp.Drawing.Tests.csproj
@@ -2,7 +2,8 @@
- netcoreapp3.1;netcoreapp2.1;net472
+
+ netcoreapp3.1
True
latest
True
diff --git a/tests/ImageSharp.Drawing.Tests/ProfilingBenchmarks.cs b/tests/ImageSharp.Drawing.Tests/ProfilingBenchmarks.cs
new file mode 100644
index 000000000..d1311a23a
--- /dev/null
+++ b/tests/ImageSharp.Drawing.Tests/ProfilingBenchmarks.cs
@@ -0,0 +1,68 @@
+using System.Text;
+using SixLabors.Fonts;
+using SixLabors.ImageSharp.Drawing.Processing;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Drawing.Tests
+{
+ public class ProfilingBenchmarks
+ {
+ [Theory]
+ [WithSolidFilledImages(1300, 1300, 0, 0, 0, PixelTypes.Rgba32, 5, 20, 36)]
+ public void RenderLongText(TestImageProvider provider, int times, int rows, int cols)
+ where TPixel : unmanaged, IPixel
+ {
+ using Image image = provider.GetImage();
+ Font font = CreateFont("Arial", 50);
+
+ var text = CreateText(rows, cols);
+ for (int i = 0; i < times; i++)
+ {
+ image.Mutate(ctx => ctx.DrawText(text, font, Color.White, default));
+ // if (i == 0)
+ // {
+ // image.DebugSave(provider);
+ // }
+ }
+ }
+
+ private static string CreateText(int rows, int cols)
+ {
+ StringBuilder bld = new StringBuilder();
+ const char firstChar = '!';
+ const char lastChar = 'z';
+ int cnt = lastChar - firstChar;
+
+ int currentChar = firstChar;
+ for (int i = 0; i < rows; i++)
+ {
+ for (int j = 0; j < cols; j++)
+ {
+ bld.Append((char)currentChar);
+ currentChar++;
+ if (currentChar > lastChar)
+ {
+ currentChar = firstChar;
+ }
+ }
+
+ bld.AppendLine();
+ }
+
+ string text = bld.ToString();
+ return text;
+ }
+
+
+ private static Font CreateFont(string fontName, int size)
+ {
+ return SystemFonts.CreateFont(fontName, size);
+ // var fontCollection = new FontCollection();
+ // string fontPath = TestFontUtilities.GetPath(fontName);
+ // Font font = fontCollection.Install(fontPath).CreateFont(size);
+ // return font;
+ }
+ }
+}
\ No newline at end of file