-
-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp.Drawing
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
(Wasn't sure if this should go here or in SixLabors.Fonts)
I'm trying to convert a working game engine from system.drawing, but my game engine (which usually hits 60 FPS without a problem) shows less than 10 FPS, due to a debug label which shows the cursor position and constantly updates as the cursor moves.
When I measured the text rendering time, I saw that ImageSharp.Drawing takes somewhat between 90ms and 170ms (median: 134ms) to render the text, and system.drawing takes ~0.3ms for rendering the text, so somewhat between x300 and x400 better performance.
Here's the analysis from xamarin profiler:

FindIntersectionWithOrientation seems to be the biggest bottleneck: I'm completely ignorant when it comes to text rendering, I'm curious why we even need to find intersections when rendering text, I always imagined a glyph is just a series of path instructions that you map to size and render as is.
Steps to Reproduce
- Run
DemoDesktopfrom here: https://github.com/tzachshabtay/MonoAGS/tree/ImageSharp (using Visual Studio for Mac) - Move your cursor around after the loading screen, and see the slowness
- The slow line is here: https://github.com/tzachshabtay/MonoAGS/blob/080bba5c186db4b88cb96e7c4940874cd5327102/Source/Engine/AGS.Engine/Misc/ImageSharp/ImageSharpTextDraw.cs#L89
If you want to compare to the system.drawing version, checkout the master branch, the equivalent line is here:
https://github.com/tzachshabtay/MonoAGS/blob/cadd7acbef6b1a97e47166681ba7e349074c4b47/Source/Engine/AGS.Engine.Desktop/Drawing/DesktopBitmapTextDraw.cs#L93
System Configuration
- ImageSharp.Drawing version: 1.0.0-beta0009
- Other ImageSharp packages and versions: ImageSharp 1.0.0-rc0003
- Environment (Operating system, version and so on): Mac OSX Mojave 10.14
- .NET Framework version:
Mono JIT compiler version 6.4.0.208 (2019-06/07c23f2ca43 Wed Oct 2 04:52:23 EDT 2019)