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

C2-2727: improve loadAuthenticationSubject performance #2595

Merged
merged 4 commits into from Jun 5, 2023
Merged

Conversation

ivansenic
Copy link
Contributor

@ivansenic ivansenic commented May 25, 2023

What this PR does:
Improves perf of the authentication user serialization, as it appears on the hot path with 5% alloc samples:

  • remove the builtinContainerAttributes for immutable classes
  • avoid using builders
  • better map construction

Micro-benchmarking shows 2x throughput and 3x less allocation per op:

Before

 * Benchmark                                                                       (propertyCount)   Mode  Cnt     Score    Error   Units
 * AuthenticationSerializationBench.loadAuthenticationSubject                                    2  thrpt    5     1.642 ±  0.044  ops/us
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate                     2  thrpt    5  2630.386 ± 70.494  MB/sec
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate.norm                2  thrpt    5  1680.000 ±  0.001    B/op
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.count                          2  thrpt    5   333.000           counts
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.time                           2  thrpt    5   223.000               ms
 * AuthenticationSerializationBench.loadAuthenticationSubject                                    4  thrpt    5     1.103 ±  0.045  ops/us
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate                     4  thrpt    5  2440.713 ± 99.410  MB/sec
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate.norm                4  thrpt    5  2320.000 ±  0.001    B/op
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.count                          4  thrpt    5   338.000           counts
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.time                           4  thrpt    5   228.000               ms

After

 * Benchmark                                                                       (propertyCount)   Mode  Cnt     Score     Error   Units
 * AuthenticationSerializationBench.loadAuthenticationSubject                                    2  thrpt    5     3.384 ±   0.230  ops/us
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate                     2  thrpt    5  1807.395 ± 123.001  MB/sec
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate.norm                2  thrpt    5   560.000 ±   0.001    B/op
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.count                          2  thrpt    5   338.000            counts
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.time                           2  thrpt    5   228.000                ms
 * AuthenticationSerializationBench.loadAuthenticationSubject                                    4  thrpt    5     2.137 ±   0.029  ops/us
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate                     4  thrpt    5  1728.442 ±  23.497  MB/sec
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.alloc.rate.norm                4  thrpt    5   848.000 ±   0.001    B/op
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.count                          4  thrpt    5   333.000            counts
 * AuthenticationSerializationBench.loadAuthenticationSubject:·gc.time                           4  thrpt    5   227.000                ms

Which issue(s) this PR fixes:
Internal issue.

Tasks:

  • add readme for the microbench module

@ivansenic ivansenic requested a review from a team as a code owner May 25, 2023 09:07
Copy link
Contributor

@maheshrajamani maheshrajamani left a comment

Choose a reason for hiding this comment

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

LGTM

@ivansenic ivansenic merged commit 3442766 into main Jun 5, 2023
20 checks passed
@ivansenic ivansenic deleted the ise-C2-2727 branch June 5, 2023 09:07
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.

None yet

2 participants