Skip to content
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(declarative) use luajit serializer for lmdb #8942

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

bungle
Copy link
Member

@bungle bungle commented Jun 13, 2022

Summary

Replaces cjson based serializer with LuaJIT string.buffer serializer.

@bungle bungle requested a review from dndx June 13, 2022 19:55
@bungle bungle requested a review from a team as a code owner June 13, 2022 19:55
@bungle bungle force-pushed the perf/lmdb-luajit-serializer branch from db7deb8 to fb0c5cc Compare June 13, 2022 19:57
shm_value = function(str_value, value_type)
return fmt("%d:%s", value_type, str_value)
end,
local encode = buffer.encode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I had been meaning to try this out myself.

I wonder if it's possible to use the dict optimization that the docs describe here:

https://github.com/openresty/luajit2/blob/124ff8dcf4ec0c158fcf7b44efbffc9093656f6c/doc/ext_buffer.html#L463-L487

(can't seem to find a published version of this html)

Adding some field names from core entities would probably be a performance win. The only downside is the list has to be fairly static or else we risk the persisted data becoming unreadable. I guess maybe we could store the list as metadata in lmdb too (in pure json or some other format that is guaranteed to be forward-safe).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flrgh, yes dict optimization for sure, need to analyze the data a bit to compile nice dictionary. Perhaps we can do it in different PR though.

@bungle bungle force-pushed the perf/lmdb-luajit-serializer branch from fb0c5cc to 713f5a7 Compare June 13, 2022 21:04
@bungle
Copy link
Member Author

bungle commented Jun 13, 2022

Seems to be green now, other than the perf tests which have been broken for known reasons.

@bungle bungle merged commit 802e1aa into master Jun 14, 2022
@bungle bungle deleted the perf/lmdb-luajit-serializer branch June 14, 2022 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants