-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat(sozo): in build stats add bytecode and class size of casm class #2004
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2004 +/- ##
==========================================
+ Coverage 67.50% 67.54% +0.03%
==========================================
Files 318 318
Lines 37880 37979 +99
==========================================
+ Hits 25572 25654 +82
- Misses 12308 12325 +17 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @lambda-0x for those fixes! It will be great to have those numbers and also see how the Sierra / casm sizes are evolving.
Some minor comment, but overall it looks great.
@@ -55,19 +93,30 @@ pub fn get_contract_statistics_for_dir( | |||
let contract_name: String = | |||
path.file_stem().context("Error getting file name")?.to_string_lossy().to_string(); | |||
|
|||
// To ignore files like `contract.contract_class.json` or | |||
// `contract.compiled_contract_class.json` | |||
if contract_name.contains('.') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those one are not usually present in a dojo project, but good to keep this in case. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would cause issue when someone adds sierra = true
or casm = true
in manifest file manually for any reason, which i did for testing file size of casm class.
crates/sozo/ops/src/statistics.rs
Outdated
get_file_size(&sierra_json_file).context("Error getting file size")?; | ||
let sierra_bytecode_size = get_sierra_byte_code_size(sierra_class); | ||
|
||
let casm_contract_class_size = serde_json::to_string(&casm_class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't a way to factorize how the byte size of a file is computed? (for Sierra and casm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm the table takes a considerable amount of screen real estate to display it without wrapping.
what do you think about compressing the table somehow? like deferring the units in the help message? or if the table lib that we're using can somehow do the header row like so:
+-------------+
| Col1 |
+-------------+
| Col1 | Col2 |
+------+------+
| 1 | 2 |
| 3 | 4 |
+------+------+
Good idea, could help to have more concise report. We could have an introductory message before the table to add enough context for users to understand the table and get used to it. |
the library we are using doesn't support it atm, see: phsym/prettytable-rs#91 |
Not bad, but i think should remove the parentheses in the non-header cells.
yeah i think looking at it from the perspective of user that haven't seen the starknet docs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go for the first iteration, nice @lambda-0x!
fix: #1952