Skip to content

Optimize FigureLength struct conversion to string, reduce allocations #9888

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Oct 3, 2024

Description

Optimizes conversion of FigureLength to string. Simplifies Can* methods, adds some documentation.

Simple ToString conversion

Method figureLength Mean [ns] Error [ns] StdDev [ns] Gen0 Code Size [B] Allocated [B]
Original 999 102.3501 ns 2.0471 ns 3.0640 ns 0.0048 4,171 B 80 B
PR__EDIT 999 76.9590 ns 1.3950 ns 1.2367 ns 0.0029 957 B 48 B
yield return new FigureLength(999.0, FigureUnitType.Column);

Customer Impact

Improved performance, decreased allocations.

Regression

No.

Testing

Local build, conversion tests.

Risk

Low; do note that #9887 should be taken first imho.

Microsoft Reviewers: Open in CodeFlow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions Included in test pass PR metadata: Label to tag PRs, to facilitate with triage Status:Completed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants