Skip to content

Improve online deserialization latency - #2164

Merged
feast-ci-bot merged 1 commit into
feast-dev:masterfrom
judahrand:perf-online
Dec 21, 2021
Merged

feast-ci-bot merged 1 commit into
feast-dev:masterfrom
judahrand:perf-online

Conversation

@judahrand

@judahrand judahrand commented Dec 20, 2021 •

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

@tsotnet Relevant for your benchmarking perhaps?

@achals

achals commented Dec 21, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
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

judahrand commented Dec 21, 2021 •

Copy link
Copy Markdown
Member Author

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

judahrand commented Dec 21, 2021 •

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Member Author

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

@achals achals left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

Details 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
Copy Markdown
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

achals commented Dec 21, 2021

Copy link
Copy Markdown
Member

@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