JosiahWI commented on PR #11675:
URL: https://github.com/apache/trafficserver/pull/11675#issuecomment-2286682093
I tried reserving space in the JA4 string since I know exactly how much it
needs.
## Benchmark
```cpp
TEST_CASE("test")
{
BENCHMARK("a bench")
{
JA4::TLSClientHelloSummary TLS_summary;
TLS_summary.protocol = JA4::Protocol::TLS;
CHECK("t" == call_JA4(TLS_summary).substr(0, 1));
};
}
```
## Release build, without reserve:
```
benchmark name samples iterations estimated
mean low mean high mean
std dev low std dev high std dev
-------------------------------------------------------------------------------
a bench 100 382 1.8718
ms
49.5716 ns 49.5445 ns 49.6664
ns
0.231883 ns 0.0710694 ns 0.52879
ns
```
## Release build, with reserve:
```
benchmark name samples iterations estimated
mean low mean high mean
std dev low std dev high std dev
-------------------------------------------------------------------------------
a bench 100 327 1.8966
ms
58.1452 ns 58.1222 ns 58.1835
ns
0.150304 ns 0.103122 ns 0.272601
ns
```
I'm thinking it's best not to call reserve here. I could try resize but I'd
have to change the way the pieces of the string are inserted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]