You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2022/01/26 02:44:06 UTC

[rocketmq] branch develop updated: perf: avoid multiple expansion when the number of elements in the `MessageConst` class is determined (#3721)

This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8ce2cdb  perf: avoid multiple expansion when the number of elements in the `MessageConst` class is determined (#3721)
8ce2cdb is described below

commit 8ce2cdb004a6b968ad51a985fa262b84fa97d041
Author: Xinda <xd...@gmail.com>
AuthorDate: Wed Jan 26 10:44:01 2022 +0800

    perf: avoid multiple expansion when the number of elements in the `MessageConst` class is determined (#3721)
    
    `HashSet`, threshold = initialCapacity * 0.75
---
 .../src/main/java/org/apache/rocketmq/common/message/MessageConst.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
index ba9b744..81b7823 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
@@ -57,7 +57,7 @@ public class MessageConst {
 
     public static final String KEY_SEPARATOR = " ";
 
-    public static final HashSet<String> STRING_HASH_SET = new HashSet<String>();
+    public static final HashSet<String> STRING_HASH_SET = new HashSet<>(64);
 
     static {
         STRING_HASH_SET.add(PROPERTY_TRACE_SWITCH);