Skip to content

Comments

Inline System.Boolean Parse helper methods#64771

Closed
L2 wants to merge 1 commit intodotnet:mainfrom
amd:boolInline
Closed

Inline System.Boolean Parse helper methods#64771
L2 wants to merge 1 commit intodotnet:mainfrom
amd:boolInline

Conversation

@L2
Copy link
Contributor

@L2 L2 commented Feb 3, 2022

  • Profiling the boolean parse method showed that its
    helper methods weren't being inlined
  • Increases performance on the System.Tests.Perf_Boolean.Parse*
    microbenchmarks

- Profiling the boolean parse method showed that its
  helper methods weren't being inlined
- Increases performance on the System.Tests.Perf_Boolean.Parse*
  microbenchmarks
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Feb 3, 2022
@ghost
Copy link

ghost commented Feb 3, 2022

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@L2
Copy link
Contributor Author

L2 commented Feb 3, 2022

summary:
better: 2, geomean: 7.583
total diff: 2

No Slower results for the provided threshold = 5% and noise filter = 0.3ns.

Faster base/diff Base Median (ns) Diff Median (ns) Modality
System.Tests.Perf_Boolean.Parse(value: "True") 7.97 21.99 2.76
System.Tests.Perf_Boolean.Parse(value: "False") 7.22 21.96 3.04

@danmoseley
Copy link
Member

Thanks. It's unfortunately hard to make inlining decisions by running microbenchmarks - the microbenchmarks almost invariably get faster, but in a real app, the code can get significantly bigger.

If it's helpful to inline these, perhaps we should consider why they're not getting inlined.

@stephentoub
Copy link
Member

The implementations can be streamlined with fewer reads:
#64782

@L2
Copy link
Contributor Author

L2 commented Feb 4, 2022

Thanks. It's unfortunately hard to make inlining decisions by running microbenchmarks - the microbenchmarks almost invariably get faster, but in a real app, the code can get significantly bigger.

If it's helpful to inline these, perhaps we should consider why they're not getting inlined.

Sounds good, I'll close this PR for now as @stephentoub 's implementation is the better way to go to extract more performance. Thanks again @danmoseley

The implementations can be streamlined with fewer reads: #64782

@stephentoub , very nice!

@L2 L2 closed this Feb 4, 2022
@danmoseley
Copy link
Member

Do appreciate the attempt though @L2. There are lots of issues marked up for grabs if you want to look at another.

@danmoseley
Copy link
Member

And we appreciate the inspiration here!

@stephentoub
Copy link
Member

And we appreciate the inspiration here

Yeah I wouldn't have noticed if this PR didn't draw my eyes to it :-)

@ghost ghost locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants