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

Read message type from fix string without regex #909

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jkulubya
Copy link

I'm investigating how to have the message type as part of the log's context when a message is sent/received in #899, and that might require calling GetMsgType on the hot path. This pr removes the regex from that method, in case that's the way forward.

BenchmarkDotNet v0.14.0, NixOS 24.11 (Vicuna)
    11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
    .NET SDK 8.0.307
      [Host]     : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      DefaultJob : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

    | Method | Mean      | Error    | StdDev    | Gen0   | Allocated |
    |------- |----------:|---------:|----------:|-------:|----------:|
    | Manual |  35.33 ns | 2.754 ns |  8.122 ns | 0.0038 |      24 B |
    | Regex  | 322.38 ns | 9.405 ns | 25.265 ns | 0.0648 |     408 B |

Manual is this PR, Regex is current code.

BenchmarkDotNet v0.14.0, NixOS 24.11 (Vicuna)
    11th Gen Intel Core i7-1165G7 2.80GHz, 1 CPU, 8 logical and 4 physical cores
    .NET SDK 8.0.307
      [Host]     : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      DefaultJob : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

    | Method | Mean      | Error    | StdDev    | Gen0   | Allocated |
    |------- |----------:|---------:|----------:|-------:|----------:|
    | Manual |  35.33 ns | 2.754 ns |  8.122 ns | 0.0038 |      24 B |
    | Regex  | 322.38 ns | 9.405 ns | 25.265 ns | 0.0648 |     408 B |
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.

1 participant