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

[IMPROVED] Performance of respToken #1575

Merged
merged 1 commit into from
Feb 29, 2024
Merged

[IMPROVED] Performance of respToken #1575

merged 1 commit into from
Feb 29, 2024

Conversation

piotrpio
Copy link
Collaborator

@piotrpio piotrpio commented Feb 29, 2024

Using fmt.Sscanf() in muxer caused performance overhead for each request sent by the client. It is sufficient to only compare the expected inbox prefix with the response subject and grab the token from the end of the subject (as is done in other clients).

Benchmark results:

  1. Using fmt.Sscanf: BenchmarkRespToken-10 2836392 418.7 ns/op 83 B/op 4 allocs/op
  2. Comparing prefixes: BenchmarkRespToken-10 408571200 2.837 ns/op 0 B/op 0 allocs/op

Fixes #1560

Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@piotrpio piotrpio merged commit 3fefbb2 into main Feb 29, 2024
1 of 2 checks passed
@piotrpio piotrpio deleted the improve-resptoken branch February 29, 2024 20:42
@piotrpio piotrpio mentioned this pull request Mar 20, 2024
piotrpio added a commit that referenced this pull request Aug 15, 2024
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
piotrpio added a commit that referenced this pull request Aug 15, 2024
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
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.

the cost of respToken in respHandler is much higher than expected
4 participants