Skip to content

[Windows] Optimize formatted labels#28073

Merged
PureWeen merged 1 commit intodotnet:mainfrom
MartyIX:feature/2025-02-27-optimize-formatted-label-on-Windows-2
Mar 3, 2025
Merged

[Windows] Optimize formatted labels#28073
PureWeen merged 1 commit intodotnet:mainfrom
MartyIX:feature/2025-02-27-optimize-formatted-label-on-Windows-2

Conversation

@MartyIX
Copy link
Copy Markdown
Contributor

@MartyIX MartyIX commented Feb 27, 2025

Description of Change

Optimizes formatted texts on Windows. Sample:

<Label>
  <Label.FormattedText>
    <FormattedString>
      <Span Text=" A " />
      <Span Text=" B " />
      <Span Text=" C " />
    </FormattedString>
  </Label.FormattedText>
</Label>

Performance impact

image

Speedscopes:

-> Improvement of ~56%

@MartyIX MartyIX requested a review from a team as a code owner February 27, 2025 10:36
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Feb 27, 2025
TextTransform defaultTextTransform = TextTransform.Default)
{
textBlock.Inlines.Clear();
var textBlockInlines = textBlock.Inlines;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store Inlines in a variable to avoid perf hit.

@jsuarezruiz jsuarezruiz added platform/windows area-controls-label Label, Span perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) labels Feb 27, 2025
@jfversluis
Copy link
Copy Markdown
Member

/azp run

@jfversluis jfversluis added this to the .NET 9 SR5 milestone Feb 28, 2025
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen moved this from Todo to Approved in MAUI SDK Ongoing Mar 3, 2025
@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Mar 3, 2025

  • test failures on unrelated platforms

@PureWeen PureWeen merged commit 804abf3 into dotnet:main Mar 3, 2025
110 of 124 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Mar 3, 2025
@MartyIX MartyIX deleted the feature/2025-02-27-optimize-formatted-label-on-Windows-2 branch March 3, 2025 18:09
tj-devel709 pushed a commit that referenced this pull request Mar 3, 2025
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Mar 7, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-label Label, Span community ✨ Community Contribution perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) platform/windows

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants