Optimize diagnostics flattening in get_all#9828
Optimize diagnostics flattening in get_all#9828integraledelebesgue wants to merge 1 commit intomainfrom
get_all#9828Conversation
|
This change is part of the following stack: Change managed by git-spice. |
get_allget_all
orizi
left a comment
There was a problem hiding this comment.
@orizi made 6 comments.
Reviewable status: 0 of 1 files reviewed, 6 unresolved discussions (waiting on integraledelebesgue).
crates/cairo-lang-diagnostics/src/diagnostics.rs line 341 at r1 (raw file):
} fn all_count(&self) -> usize {
move helpers to after usages.
crates/cairo-lang-diagnostics/src/diagnostics.rs line 341 at r1 (raw file):
} fn all_count(&self) -> usize {
doc
crates/cairo-lang-diagnostics/src/diagnostics.rs line 345 at r1 (raw file):
} pub fn extend_all_into(&self, out: &mut Vec<TEntry>) {
Suggestion:
fn extend_all_into(&self, out: &mut Vec<TEntry>) {crates/cairo-lang-diagnostics/src/diagnostics.rs line 345 at r1 (raw file):
} pub fn extend_all_into(&self, out: &mut Vec<TEntry>) {
doc
crates/cairo-lang-diagnostics/src/diagnostics.rs line 345 at r1 (raw file):
} pub fn extend_all_into(&self, out: &mut Vec<TEntry>) {
move helpers to after usages.
crates/cairo-lang-diagnostics/src/diagnostics.rs line 350 at r1 (raw file):
subtree.extend_all_into(out); } }
if works (probably doesn't)
and than use extend directly.
Suggestion:
pub fn iter<'a>(&'a self) -> impl Iterator<Item=&'a TEntry> {
self.0.leaves.iter().chain(
self.0.subtrees.iter().map(|subtree| subtree.iter()).flatten()
)
}37603a6 to
31b692a
Compare
integraledelebesgue
left a comment
There was a problem hiding this comment.
@integraledelebesgue made 6 comments.
Reviewable status: 0 of 1 files reviewed, 6 unresolved discussions (waiting on orizi).
crates/cairo-lang-diagnostics/src/diagnostics.rs line 341 at r1 (raw file):
Previously, orizi wrote…
move helpers to after usages.
Done.
crates/cairo-lang-diagnostics/src/diagnostics.rs line 341 at r1 (raw file):
Previously, orizi wrote…
doc
Done.
crates/cairo-lang-diagnostics/src/diagnostics.rs line 345 at r1 (raw file):
Previously, orizi wrote…
doc
Done.
crates/cairo-lang-diagnostics/src/diagnostics.rs line 345 at r1 (raw file):
Previously, orizi wrote…
move helpers to after usages.
Done.
crates/cairo-lang-diagnostics/src/diagnostics.rs line 350 at r1 (raw file):
Previously, orizi wrote…
if works (probably doesn't)
and than useextenddirectly.
Doesn't work; rustc can't handle the generic return type in a recursive call for some reason
crates/cairo-lang-diagnostics/src/diagnostics.rs line 345 at r1 (raw file):
} pub fn extend_all_into(&self, out: &mut Vec<TEntry>) {
Done.
31b692a to
a2586c5
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 6 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on integraledelebesgue).
piotmag769
left a comment
There was a problem hiding this comment.
@piotmag769 reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on integraledelebesgue).
Summary
Collecting the diagnostic trees into a pre-allocated vector significantly reduces the amount of intermediate allocations.
Results in a huge gain of performance in CairoLS.
Type of change
Please check one: