-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The performance of 'DrawLines' degrades the thinner the lines are #18
Comments
DrawLines
degrades the thinner the lines are
DrawLines
degrades the thinner the lines are
Thanks @pmcxs for all the detail. We're planning on separating ImagSharp.Drawing into a separate repository as we really haven't begun to do the same performance work on that library as we have the main library and we don't want to delay the main libraries RC1 release . It would be brilliant if you have any advice to give once we do that migration. |
Wouldn't a simple explanation behind why larger lines are faster is because the stopwatch includes the PNG saving to disk and larger lines produce a less-complex PNG and therefore improves performance during serialization. |
@implemental Yep, that’s definitely a factor. I hadn’t actually looked at the benchmarking code.... it’s not great. System.Drawing saves png’s at zlib compression level 1 with no filter where we use level 6 with paeth filtering. The encoding speed alone with be 2-3x slower. |
There are two factors explaining this:
I don't think we can do anything with (1) since it's just the math behind extending a multi-line to a polygon. (2) will be fixed with #96. @pmcxs if still interested, check out our nightly builds after we merge that PR (ETA: couple of days). |
Actually, I consider this issue to be fixed by #96. |
Prerequisites
DEBUG
andRELEASE
modeDescription
Drawing thinner lines takes much more time to process than broader lines.
The following tests were done on a 500x500 image (sorted by processing time):
1000 10px lines render faster than 100 1px lines, which seems strange.
Steps to Reproduce
Option 1
Create a simple project, referencing the latest ImageSharp library and include the code below:
Option 2
This was detected on a comparison between ImageSharp, System.Drawing and a custom simplified implementation. That benchmark is available at: https://github.com/pmcxs/core-linedrawing-benchmark/. It can be executed to replicate the issue:
System Configuration
The text was updated successfully, but these errors were encountered: