Skip to content

Commit

Permalink
Use skip_attributes to improve performance (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc authored Oct 24, 2021
1 parent ce1aa2c commit 88b7e34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "./README.md"
repository = "https://github.com/gimli-rs/addr2line"

[dependencies]
gimli = { version = "0.25", default-features = false, features = ["read"] }
gimli = { version = "0.26", default-features = false, features = ["read"] }
fallible-iterator = { version = "0.2", default-features = false, optional = true }
object = { version = "0.26", default-features = false, features = ["read"], optional = true }
smallvec = { version = "1", default-features = false, optional = true }
Expand Down
28 changes: 4 additions & 24 deletions src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,7 @@ impl<R: gimli::Reader> Functions<R> {
functions.push((dw_die_offset, LazyCell::new()));
}
} else {
for spec in abbrev.attributes() {
match entries.read_attribute(*spec) {
Ok(_) => {}
Err(e) => return Err(e),
}
}
entries.skip_attributes(abbrev.attributes())?;
}
}
}
Expand Down Expand Up @@ -276,12 +271,7 @@ impl<R: gimli::Reader> Function<R> {
)?;
}
_ => {
for spec in abbrev.attributes() {
match entries.read_attribute(*spec) {
Ok(_) => {}
Err(e) => return Err(e),
}
}
entries.skip_attributes(abbrev.attributes())?;
}
}
}
Expand All @@ -294,20 +284,10 @@ impl<R: gimli::Reader> Function<R> {
depth: isize,
) -> Result<(), Error> {
// TODO: use DW_AT_sibling
for spec in abbrev.attributes() {
match entries.read_attribute(*spec) {
Ok(_) => {}
Err(e) => return Err(e),
}
}
entries.skip_attributes(abbrev.attributes())?;
while entries.next_depth() > depth {
if let Some(abbrev) = entries.read_abbreviation()? {
for spec in abbrev.attributes() {
match entries.read_attribute(*spec) {
Ok(_) => {}
Err(e) => return Err(e),
}
}
entries.skip_attributes(abbrev.attributes())?;
}
}
Ok(())
Expand Down

0 comments on commit 88b7e34

Please sign in to comment.