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

Micro-optimize PFR fields detection #188

Merged
merged 8 commits into from
Oct 15, 2024
Merged

Micro-optimize PFR fields detection #188

merged 8 commits into from
Oct 15, 2024

Conversation

apolukhin
Copy link
Member

@apolukhin apolukhin commented Oct 13, 2024

  • Start upper bound fields search from 4 fields, to avoid slow startup on typical workloads
  • Inline the fields_count_binary_search_unbounded function to reduce template instantiations depth by 1
  • Renamed min to min_of_size_t to avoid weired syntax
  • Applied idea of better error reporting from Improve field count typical case performance #120
  • Do not start fields count computation if one of the static asserts failed. That speedups error reporting in edge cases
  • Use std::*_t versions of traits as they are faster in some implementations
  • Rewrite binary search to simplify it and to avoid degradation to linear search on types that have constructor from variadic pack
  • Remove default template parameters to simplify code

As a result, the whole test suite now runs 10%-25% faster on MSVC, ~20% faster on Clang, and 7%-20% faster on GCC.

@coveralls
Copy link

coveralls commented Oct 13, 2024

Pull Request Test Coverage Report for Build 11339766261

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 11253776824: 0.0%
Covered Lines: 407
Relevant Lines: 407

💛 - Coveralls

@apolukhin apolukhin changed the title Speedup PFR fields detection Micro-optimize PFR fields detection Oct 13, 2024
@apolukhin apolukhin merged commit 469ac13 into develop Oct 15, 2024
11 checks passed
@apolukhin apolukhin deleted the speedup-edge-cases branch October 15, 2024 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants