Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @TomerStarkware).
crates/cairo-lang-lowering/src/lower/mod.rs line 2321 at r1 (raw file):
} /// Binds input references when matching on extern functions.
Update comment
ccca11f to
ae9d636
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @eytan-starkware and @TomerStarkware).
crates/cairo-lang-lowering/src/lower/mod.rs line 2321 at r1 (raw file):
Previously, eytan-starkware wrote…
Update comment
Done.
06c3c66 to
de768f3
Compare
ae9d636 to
0fa8e71
Compare
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 1 file and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware).
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware).

Summary
Refactored the
extern_facade_return_tysfunction to return a slice instead of a vector, improving performance by avoiding unnecessary allocations. Also modifiedextern_facade_exprto accept an iterator instead of a vector, allowing for more flexible usage patterns. Updated all call sites to accommodate these changes, resulting in cleaner code that avoids unnecessary vector allocations and copies.Type of change
Please check one:
Why is this change needed?
The previous implementation was creating unnecessary vector allocations when processing extern function return types. By changing the return type to a slice and accepting iterators instead of vectors, we reduce memory allocations and improve performance in the lowering phase.
What was the behavior or documentation before?
Previously,
extern_facade_return_tyswould always allocate a new vector even when returning a single type, andextern_facade_exprrequired a fully constructed vector to be passed in, leading to additional allocations and copies.What is the behavior or documentation after?
Now
extern_facade_return_tysreturns a slice (either a reference to the existing tuple types or a single-element slice), andextern_facade_expraccepts any exact-size iterator of variable IDs, allowing callers to avoid unnecessary allocations.Additional context
This change is part of ongoing efforts to optimize the compiler's memory usage and performance. The modifications maintain the same functionality while reducing allocations in the hot path of the lowering phase.