Skip to content

Optimize low hanging fruit - #382

Merged
JimBobSquarePants merged 3 commits into
mainfrom
js/low-hanging-fruit
Feb 15, 2024
Merged

Optimize low hanging fruit#382
JimBobSquarePants merged 3 commits into
mainfrom
js/low-hanging-fruit

Conversation

@JimBobSquarePants

@JimBobSquarePants JimBobSquarePants commented Feb 14, 2024

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

I did a little tracing to see if there were any obvious bottlenecks. We get a nice speedup over longer text. I also made our lazy instances thread safe.

Also includes a fix for #383

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22631
11th Gen Intel Core i7-11370H 3.30GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK=8.0.200-preview.23624.5
  [Host]   : .NET 6.0.26 (6.0.2623.60508), X64 RyuJIT
  ShortRun : .NET 6.0.26 (6.0.2623.60508), X64 RyuJIT

Job=ShortRun  IterationCount=3  LaunchCount=1
WarmupCount=3

PR

Method Text Mean Error StdDev
SixLaborsFonts Lore(...)tus. [2477] 19,515.541 us 3,656.2844 us 200.4133 us

Main

Method Text Mean Error StdDev
SixLaborsFonts Lore(...)tus. [2477] 20,980.555 us 8,470.2382 us 464.2823 us

tocsoft
tocsoft previously approved these changes Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextRenderer.RenderTextTo throws ArgumentOutOfRangeException when use WordBreaking.BreakAll and small WrappingLength

2 participants