Tencent / TubeMQ

TubeMQ has been donated to the Apache Software Foundation and renamed to InLong, please visit the new Apache repository: https://github.com/apache/incubator-inlong
https://inlong.apache.org/
2.02k stars 388 forks source link

Comb the use points of isBlank() function to reduce unnecessary checks #123

Open gosonzhang opened 5 years ago

gosonzhang commented 5 years ago

see https://github.com/Tencent/TubeMQ/pull/122

After I think about it, this PR reminds me that if the content of a string has been checked by isBlank() and the string still exists in memory, the next step is to do null judgment processing, which should only be isEmpty(), so as to improve the overall processing performance.

Next, I will comb the call points of the isBlank() function, and check the contents that have been checked by isBlank(). When checking again, I'll use isEmpty() instead to reduce unnecessary checking


考虑这个PR之后,我觉得当前使用isBlank()有些地方需要整理一下:如果一个字符串的内容已经被isBlank()检查过,并且字符串仍然存在于内存中,下一步做isBlank()判断处理的地方可以是isEmpty(),从而提高整个处理性能。

接下来,我将梳理isBlank()函数的调用点,并检查isBlank()检查的内容,使用isEmpty()来减少不必要的检查