songgaoye opened a new pull request, #3781:
URL: https://github.com/apache/brpc/pull/3781

   ### What problem does this PR solve?
   
   Issue Number: resolve
   
   Problem Summary:
   
   `RedisClusterChannel::HashSlot()` calls `ExtractHashtag()` for every routed
   key. The helper returns a `std::string`, which copies either the entire key 
or
   the substring inside `{...}` before calculating the CRC16 slot.
   
   ### What is changed and the side effects?
   
   Changed:
   
   - Return `butil::StringPiece` from `ExtractHashtag()`.
   - Hash the non-owning key/tag view directly in `HashSlot()`.
   - Remove the temporary string allocation and byte copy from Redis Cluster key
     routing.
   
   Side effects:
   
   - Performance effects:
   
     Avoids one temporary string allocation/copy per Redis Cluster slot lookup.
     The benefit grows with key length and also applies to hashtagged keys.
   
   - Breaking backward compatibility:
   
     None. `ExtractHashtag()` is a private helper, and the returned view is used
     only while the input key remains alive inside `HashSlot()`.
   
   ---
   
   ### Check List:
   
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to