-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apd: eliminate escape analysis barrier around Rounder
This commit reworks the `Rounder` API to eliminate the escape analysis barrier that its was creating, which was resulting in unnecessary heap allocations. The commit replaces the opaque functions used for dynamic dispatch with a switch statement, which escape analysis is more easily able to understand. Unfortunately, to do this, we need to make the roundings a closed set and remove the ability for users to supply their own rounding routines. I think this is a reasonable trade-off, given that we are not aware of anyone actually using the extra flexibility. Before ``` ➜ goescape . | grep moved ./decimal.go:325:8: moved to heap: integ ./round.go:73:7: moved to heap: y ./context.go:287:6: moved to heap: quo ``` After ``` ➜ goescape . | grep moved | wc -l 0 ```
- Loading branch information
1 parent
0da8865
commit c951ca9
Showing
4 changed files
with
58 additions
and
49 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