generated from EmbarkStudios/opensource-template
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faster and better location data (#165)
### Checklist * [x] I have read the [Contributor Guide](../CONTRIBUTING.md) * [x] I have read and agree to the [Code of Conduct](../CODE_OF_CONDUCT.md) * [x] I have added a description of my changes and why I'd like them included in the section below ### Summary Before: <img width="409" alt="puffin-before" src="https://github.com/EmbarkStudios/puffin/assets/1148717/e5722ab6-3865-4f5d-a953-672e4c1e5c86"> After: <img width="665" alt="puffin-after" src="https://github.com/EmbarkStudios/puffin/assets/1148717/dc829830-d2cf-400d-b5d5-9f92a892ff60"> ### Description of Changes This PR: * Improve the function names for `trait` calls * Adds crate name to the file path * Adds line number to the location * Optimize `profile_function` On my M1 MacBook Pro, `profile_function` goes from 86ns->58ns, about 50% faster. `profile_scope` goes from 60ns to 58ns, which is within noise levels. The optimization is done by caching the results of the location gathering functions. This also allows us to make them more expensive (since they are now only run once), and therefor more powerful. So where puffin used to output the location `mod.rs`, it now outputs `cratename/…/modulename/mod.rs:124`. I also improved the function name for when calling a trait method on a type. Previously you'd only see `TraitName>::function_name` but now you'll see `<ConreteTypeName as TraitName>::function_name`. The downside is more data being sent, but I think the improves usefulness of the location is worth it! This is _not_ a breaking change, so this can be released in a patch-release of `puffin` --------- Co-authored-by: Johan Andersson <[email protected]>
- Loading branch information
Showing
5 changed files
with
155 additions
and
26 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
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
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
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
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