dotnet/wpf

TextFormatter.FormatLine has O(n^2) performance when called multiple times

Open

#6304 aperta il 23 mar 2022

Vedi su GitHub
 (6 commenti) (2 reazioni) (0 assegnatari)C# (1126 fork)batch import
Performancehelp wanted

Metriche repository

Star
 (6683 star)
Metriche merge PR
 (Merge medio 2g 7h) (41 PR mergiate in 30 g)

Descrizione

  • .NET Core Version: .net 6
  • Windows version: 11
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? no

Actual behavior:

TextFormatter.FormatLine has O(n^2) performance

Expected behavior:

TextFormatter.FormatLine exhibits linear performance

Minimal repro: WpfFontRepro.zip

Remarks

Disposing the formatted lines or creating new TextFormatter instances prevents the O(n^2) behavior.

Guida contributor