-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(clustering) improve calculate hash performance by utilizing string buffer and tablepool #9073
Conversation
b0689f0
to
e55b07b
Compare
|
||
else | ||
local t = type(value) | ||
if t == "string" or t == "number" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we are using string buffer, i think we can also just skip type assertions and let it do the job. previously we do this because {} could be from a table or from a string "{}". but they are already encoded differently in string.buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fffonion only string
, number
and object
with __tostring
are allowed with :put
Alternatively we can use buffer.encode
but not sure it is worth it here as it is only really usable (in this case) with string
, boolean
and number
.
…ng buffer and tablepool
e55b07b
to
66543c3
Compare
A small improvement (so far):
Calculation:
|
Small test. Data loaded:
Export data:
Calculate hash:
|
Summary
Improve calculate hash performance by utilizing string buffer and tablepool.