-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make it easy to resolve symbols by frame (#526)
Hello, Resolving backtrace (at least for the first time) is very slow, but this is not something that can be solved (I guess). However, not all frames are equally useful, and at least in the code base that I'm working on, we simply ignore bunch of them. We have code something like this: ```rust let mut bt = Backtrace::new_unresolved(); // ... bt.resolve(); let bt: Vec<String> = bt.frames() .iter() .flat_map(BacktraceFrame::symbols) .take_while(is_not_async_stuff) .map(format_symbols) .collect(); ``` For us, it takes around 700~1500ms to resolve whole backtrace. With this PR we're able to write like this: ```rust let bt: Vec<String> = bt.frames_mut() .iter_mut() .flat_map(BacktraceFrame::symbols_resolved) .take_while(is_not_async_stuff) .map(format_symbols) .collect(); ``` And it takes around 25ms to resolve the frames that we actually need. I'm aware of low level utils `backtrace::trace` and `backtrace::resolve_frame`, but this would basically mean that I would basically need to reimplement Backtrace, including Serialize and Deserialize capability, which is too much.
- Loading branch information
Showing
1 changed file
with
53 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters