-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Memoise descent #2993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memoise descent #2993
Conversation
# R/plot-build.r
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do more memoisation, I think adding a dependency on memoise would be fine.
Agree - this started off by using memoise, but the digest call was a measurable overhead when the arguments to memoise on were simple strings and integers that could be pasted together to a key |
Yes, this is basically what I did here: https://github.com/clauswilke/gridtext/blob/f46c0caa018ed32fefc2ba13240e272b37ba7eed/R/grob-descent.R#L25-L55 Two comments:
|
|
I think it's probably better to have multiple independent environments that are declared close to the code that uses them. |
1 is now fixed in #2996 |
The history of One difference between those global variables and the font cache here is that the font cache should never be accessed by anything other than the Of course, then @hadley suggested to make the element tree part of the theme itself, and if we went that route then we won't ever need to interactively change the default element tree that is stored in the global element tree variable, and thus could conceivably get rid of |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
The current caching of descentDetails calls is based on the device in use, along with all relevant font specifications.
I believe @clauswilke has looked into something similar but unsure what he ended up with suggesting - this works well, though...