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(python): Improve tuple and list serializer performance #1933

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

penguin-wwy
Copy link
Contributor

What does this PR do?

Pre-allocate memory for sequence containers based on the data size to avoid resizing and improve deserialization performance.

Related issues

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

python format

python -m pyperf compare_to base.json opt.json
fury_large_tuple: Mean +- std dev: [base] 104 ms +- 2 ms -> [opt] 92.7 ms +- 5.5 ms: 1.13x faster
fury_large_list: Mean +- std dev: [base] 98.5 ms +- 3.7 ms -> [opt] 92.8 ms +- 5.3 ms: 1.06x faster

Benchmark hidden because not significant (2): fury_tuple, fury_list

xlang format

python -m pyperf compare_to base_xlang.json opt_xlang.json
fury_tuple: Mean +- std dev: [base_xlang] 262 us +- 6 us -> [opt_xlang] 259 us +- 5 us: 1.01x faster
fury_large_tuple: Mean +- std dev: [base_xlang] 104 ms +- 4 ms -> [opt_xlang] 90.0 ms +- 4.6 ms: 1.16x faster
fury_large_list: Mean +- std dev: [base_xlang] 97.6 ms +- 3.7 ms -> [opt_xlang] 90.0 ms +- 4.3 ms: 1.08x faster

Benchmark hidden because not significant (1): fury_list

@chaokunyang
Copy link
Collaborator

This is great! We have a new format which will improve performance a lot: https://fury.apache.org/docs/specification/fury_xlang_serialization_spec#list. Would you like to implement this format for pyfury?

@penguin-wwy
Copy link
Contributor Author

This is great! We have a new format which will improve performance a lot: https://fury.apache.org/docs/specification/fury_xlang_serialization_spec#list. Would you like to implement this format for pyfury?

Okay, I will implement it.

Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

Looks awesome

@chaokunyang chaokunyang merged commit d1eecf0 into apache:main Nov 7, 2024
37 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