BewareMyPower commented on PR #24463:
URL: https://github.com/apache/pulsar/pull/24463#issuecomment-3003882645

   Before 48ffb7abfe1b5d5ad71cc3a07627326fb84c7a5a, there is a constructor 
parameter that determines whether to initialize the `NamespaceName`. I also 
compared with the existing `TopicName` constructor, which can be found here: 
https://gist.github.com/BewareMyPower/6b83c897552c110f336e51965cc91c24
   
   The benchmark result is:
   
   ```
   TopicNameBenchmark.testConstruct                          thrpt       
312.983          ops/s
   TopicNameBenchmark.testConstructWithNamespaceInitialized  thrpt       
101.973          ops/s
   TopicNameBenchmark.testLegacyTopicName                    thrpt        
53.944          ops/s
   TopicNameBenchmark.testReadFromCache                      thrpt       
721.392          ops/s
   ```
   
   As you can see
   - Accessing it from the cache is only 2.3x faster than the latest 
implementation, which is not significant. However, to avoid debate on whether 
to remove cache in this PR, I only exposed the public constructor.
   - Skipping initialization of `NamespaceName` is 3x faster than initializing 
it immediately
   - It's 6x faster than the original implementation. Even if initializing 
`NamespaceName` immediately, it's still about 2x faster.


-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to