Skip to content
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

Implement IUtf8SpanFormattable on Complex #84779

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Apr 13, 2023

Depends on #84587
Contributes to #81500

Method Toolchain Mean Error StdDev Ratio RatioSD Code Size Allocated Alloc Ratio
ToStringDefault \main\corerun.exe 220.7 ns 4.06 ns 3.60 ns 1.00 0.00 439 B 48 B 1.00
ToStringDefault \pr\corerun.exe 203.7 ns 4.08 ns 4.00 ns 0.93 0.03 525 B 48 B 1.00
ToStringArgs \main\corerun.exe 243.2 ns 1.31 ns 1.10 ns 1.00 0.00 2,686 B 112 B 1.00
ToStringArgs \pr\corerun.exe 195.0 ns 0.78 ns 0.65 ns 0.80 0.00 543 B 48 B 0.43
TryFormat \main\corerun.exe 171.0 ns 1.97 ns 1.65 ns 1.00 0.00 642 B - NA
TryFormat \pr\corerun.exe 170.6 ns 0.30 ns 0.24 ns 1.00 0.01 589 B - NA
private Complex _c = new Complex(12.1, 15.4);
private char[] _chars = new char[100];

[Benchmark]
public string ToStringDefault() => _c.ToString();

[Benchmark]
public string ToStringArgs() => _c.ToString("G", CultureInfo.InvariantCulture);

[Benchmark]
public bool TryFormat() => _c.TryFormat(_chars, out _, default, CultureInfo.InvariantCulture);

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Apr 13, 2023

Tagging subscribers to this area: @dotnet/area-system-numerics
See info in area-owners.md if you want to be subscribed.

Issue Details

Depends on #84587

Method Toolchain Mean Error StdDev Ratio RatioSD Code Size Allocated Alloc Ratio
ToStringDefault \main\corerun.exe 220.7 ns 4.06 ns 3.60 ns 1.00 0.00 439 B 48 B 1.00
ToStringDefault \pr\corerun.exe 203.7 ns 4.08 ns 4.00 ns 0.93 0.03 525 B 48 B 1.00
ToStringArgs \main\corerun.exe 243.2 ns 1.31 ns 1.10 ns 1.00 0.00 2,686 B 112 B 1.00
ToStringArgs \pr\corerun.exe 195.0 ns 0.78 ns 0.65 ns 0.80 0.00 543 B 48 B 0.43
TryFormat \main\corerun.exe 171.0 ns 1.97 ns 1.65 ns 1.00 0.00 642 B - NA
TryFormat \pr\corerun.exe 170.6 ns 0.30 ns 0.24 ns 1.00 0.01 589 B - NA
private Complex _c = new Complex(12.1, 15.4);
private char[] _chars = new char[100];

[Benchmark]
public string ToStringDefault() => _c.ToString();

[Benchmark]
public string ToStringArgs() => _c.ToString("G", CultureInfo.InvariantCulture);

[Benchmark]
public bool TryFormat() => _c.TryFormat(_chars, out _, default, CultureInfo.InvariantCulture);
Author: stephentoub
Assignees: stephentoub
Labels:

area-System.Numerics, new-api-needs-documentation

Milestone: -

@stephentoub
Copy link
Member Author

This was rebased on the corelib additions and is ready for review.

@stephentoub stephentoub merged commit d414646 into dotnet:main Apr 17, 2023
@stephentoub stephentoub deleted the complexutf8 branch April 17, 2023 15:21
@ghost ghost locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants