mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
reduce needless 'add_string' call
Short strings in lua proto are reused most of the time. The string in SSM may be added by one service and used by other service, there is no need to call `add_string`,which will call 'new_string' first.
This commit is contained in:
@@ -419,8 +419,11 @@ luaS_clonestring(lua_State *L, TString *ts) {
|
||||
result = query_ptr(ts);
|
||||
if (result)
|
||||
return result;
|
||||
// ts is not in SSM, so recalc hash, and add it to SSM
|
||||
h = luaS_hash(str, l, 0);
|
||||
result = query_string(h, str, l);
|
||||
if (result)
|
||||
return result;
|
||||
// ts is not in SSM, so recalc hash, and add it to SSM
|
||||
return add_string(h, str, l);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user