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

simdjson inlining and idiomaticity in benchmark #134

Merged
merged 4 commits into from
Jul 1, 2024

Conversation

jkeiser
Copy link
Contributor

@jkeiser jkeiser commented Jun 30, 2024

This doesn't really make simdjson any faster than BSON or other formats, but it does bring it back in line with my expectations around performance :) After this, canada.json is the same or faster than yyjson on my machine (but only by pennies!), and remains faster on the other benchmarks.

The two changes that made the difference:

  1. Inlining the deserialization methods. On Demand is explicitly designed to take advantage of inlining.
  2. Reading the coordinate tuple [1,2] with an iterator instead of indexing it as an array.

I also removed some unnecessary boilerplate .value() and .get_array/object() methods.

NOTE: simdjson could get some small perf gains if rfl::Literal took a string_view constructor; the fact that it takes a std::string means we're forced to allocate every time we see a type, when all it really needs to do is compare the string to a static list and put the integer index in there. This seems like it would a generally positive change to reflect-cpp anyway :)

jkeiser added 4 commits June 30, 2024 16:20
simdjson On Demand takes significant advantage of inlining. Inlining
yyjson deserialization functions yields no gains (because it's already
calling out to functions for each parsing step).
@liuzicheng1987
Copy link
Contributor

@jkeiser thank you so much.

I will also add support for constructing a literal using std::string_view.

@jkeiser
Copy link
Contributor Author

jkeiser commented Jul 1, 2024

I wanted to point out here what I posted on the Reddit thread: I haven't run this on msvc. It might still be slower there, or might be fixed by the inlining (which is a pretty huge change from the optimizer's point of view, even if none of the C++ changes). We'll see :)

@liuzicheng1987 liuzicheng1987 merged commit d2bff99 into getml:main Jul 1, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants