Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Performance_fix: Move serialize to Rust #1305

Conversation

MohammadNassar1
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 commented Jan 2, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2024

Codecov Report

Attention: 242 lines in your changes are missing coverage. Please review.

Comparison is base (c47ac72) 67.01% compared to head (a7b812b) 65.12%.
Report is 1 commits behind head on main-v0.13.0.

Files Patch % Lines
...ve_blockifier/src/py_transaction_execution_info.rs 0.00% 232 Missing ⚠️
...ates/native_blockifier/src/transaction_executor.rs 0.00% 5 Missing ⚠️
crates/native_blockifier/src/py_validator.rs 0.00% 3 Missing ⚠️
crates/native_blockifier/src/py_block_executor.rs 0.00% 1 Missing ⚠️
crates/native_blockifier/src/py_utils.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           main-v0.13.0    #1305      +/-   ##
================================================
- Coverage         67.01%   65.12%   -1.90%     
================================================
  Files                53       53              
  Lines              6885     7234     +349     
  Branches           6885     7234     +349     
================================================
+ Hits               4614     4711      +97     
- Misses             1859     2116     +257     
+ Partials            412      407       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, all discussions resolved (waiting on @elintul and @Yoni-Starkware)


crates/native_blockifier/src/py_utils.rs line 15 at r1 (raw file):

#[derive(Clone, Copy, Default, Eq, FromPyObject, Hash, PartialEq, Debug, Serialize)]
pub struct PyFelt(#[pyo3(from_py_with = "int_to_stark_felt")] pub StarkFelt);

Does this mean that it already knows to map it into an int on serialize?

Code quote:

#[derive(Clone, Copy, Default, Eq, FromPyObject, Hash, PartialEq, Debug, Serialize)]
pub struct PyFelt(#[pyo3(from_py_with = "int_to_stark_felt")] pub StarkFelt);

Copy link
Collaborator

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

Good.
While this is being tested, if you want @elintul, we can check if this can be done solely with derive serde::Serialize in those structs + some serde customizations for specific serialization logic, i believe it can.

Reviewable status: 0 of 7 files reviewed, all discussions resolved (waiting on @elintul and @Yoni-Starkware)

@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/performance_fix/Move_serialize_to_Rust_2 branch 2 times, most recently from 3f7135d to 2f112b5 Compare January 2, 2024 15:26
Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

Also, you can consult with DanB team, they do stuff like this efficiently.

Reviewable status: 0 of 7 files reviewed, all discussions resolved (waiting on @elintul)

@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/performance_fix/Move_serialize_to_Rust_2 branch 2 times, most recently from 94fda43 to d26a911 Compare January 2, 2024 21:18
@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/performance_fix/Move_serialize_to_Rust_2 branch from d26a911 to a7b812b Compare January 3, 2024 09:07
Copy link
Collaborator

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

Is this PR still relevant given your other PR that uses Serialize?

Reviewable status: 0 of 7 files reviewed, all discussions resolved (waiting on @elintul)

Copy link
Contributor Author

@MohammadNassar1 MohammadNassar1 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @elintul)

a discussion (no related file):
I will close this PR., as we've decide to change the Python class instead.

Python PR: https://github.com/starkware-industries/starkware/pull/33327
Rust PR: #1315


gswirski pushed a commit to reilabs/blockifier that referenced this pull request Jun 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants