-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: avoid repeat format in calc_func_dependencies_for_project #12305
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2793,22 +2793,28 @@ fn calc_func_dependencies_for_project( | |
.filter_map(|(qualifier, f)| { | ||
let flat_name = qualifier | ||
.map(|t| format!("{}.{}", t, f.name())) | ||
.unwrap_or(f.name().clone()); | ||
.unwrap_or_else(|| f.name().clone()); | ||
input_fields.iter().position(|item| *item == flat_name) | ||
}) | ||
.collect::<Vec<_>>(), | ||
) | ||
} | ||
Expr::Alias(alias) => Ok(input_fields | ||
.iter() | ||
.position(|item| *item == format!("{}", alias.expr)) | ||
.map(|i| vec![i]) | ||
.unwrap_or(vec![])), | ||
_ => Ok(input_fields | ||
.iter() | ||
.position(|item| *item == format!("{}", expr)) | ||
.map(|i| vec![i]) | ||
.unwrap_or(vec![])), | ||
Expr::Alias(alias) => { | ||
let name = format!("{}", alias.expr); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surprise that rust compile doesn't optimize on this 😮 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe because the rust doesn't know the length of |
||
Ok(input_fields | ||
.iter() | ||
.position(|item| *item == name) | ||
.map(|i| vec![i]) | ||
.unwrap_or(vec![])) | ||
} | ||
_ => { | ||
let name = format!("{}", expr); | ||
Ok(input_fields | ||
.iter() | ||
.position(|item| *item == name) | ||
.map(|i| vec![i]) | ||
.unwrap_or(vec![])) | ||
} | ||
}) | ||
.collect::<Result<Vec<_>>>()? | ||
.into_iter() | ||
|
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.
👍