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

Improve online deserialization latency #2164

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

judahrand
Copy link
Member

@judahrand judahrand commented Dec 20, 2021

Signed-off-by: Judah Rand 17158624+judahrand@users.noreply.github.com

What this PR does / why we need it:
For _LIST type features this implementation is up to 7x faster in my testing.

For serializing and deserializing 10k rows of 3 columns DOUBLE, 3 columns FLOAT_LIST.

Old implementation:
image

New implementation:
image

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

None

Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
@judahrand
Copy link
Member Author

@tsotnet Relevant for your benchmarking perhaps?

@achals
Copy link
Member

achals commented Dec 21, 2021

This is great and much cleaner to read @judahrand - I'm curious where the speed up is coming from, is it just because we're avoiding the excess branching and if statements?

@judahrand
Copy link
Member Author

This is great and much cleaner to read @judahrand - I'm curious where the speed up is coming from, is it just because we're avoiding the excess branching and if statements?

I think it is the branching and ifs but also for list types the old implementation was looping over each element of the list and type casting it. This implementation avoids the need for that by not using MessageToDict.

From what I can tell MessageToDict does some very odd things to types. Really it should probably be called MessageToJSONDict! Accessing the elements directly avoids the weirdness with types.

@judahrand
Copy link
Member Author

judahrand commented Dec 21, 2021

I'd also add that this is relying much more on letting Protobuf sort out the conversions which might mean more of this is being done in C++ extensions?

Edit: actually I'm not sure this is true but I'll look into it.
Edit edit: I think it is probably true but only if the C++ implementation of Protobuf is also installed on the machine.

@judahrand
Copy link
Member Author

judahrand commented Dec 21, 2021

image

This is an interesting comparison between master and these changes for both with and without the C++ extensions.

The long and short is... omg install the C++ extensions! I'm unclear whether this is done by default or not through pip 🤔

@judahrand
Copy link
Member Author

Looks like most platform's wheels from pip do use the C++ extensions by default which is a relief!

Copy link
Member

@achals achals left a comment

Choose a reason for hiding this comment

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

/lgtm

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: achals, judahrand

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@feast-ci-bot feast-ci-bot merged commit f279a7d into feast-dev:master Dec 21, 2021
@judahrand
Copy link
Member Author

@achals Interestingly, there is the possibility of getting another small performance benefit by doing what is documented here: https://m.atthew.uk/posts/post.html

This is probably not worth the deploy nightmare, however.

@achals
Copy link
Member

achals commented Dec 21, 2021

@achals Interestingly, there is the possibility of getting another small performance benefit by doing what is documented here: https://m.atthew.uk/posts/post.html

This is probably not worth the deploy nightmare, however.

Thanks for the detailed info! Yeah I'm inclined to opt for simplicity over speed in this particular case. I'm sure there's other avenues to speed things up that won't complicate our packaging and deploy story.

@judahrand judahrand deleted the perf-online branch December 21, 2021 14:28
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