-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow processes to be named. #198
Conversation
Because of how R assigns names to stack frames, all processes in a typical individual simulation would end up being called `p`. This makes it difficult to interpret profiling results. R uses the name of the variable the called function is bound to. By dynamically creating a variable with a chosen name and using `eval` to execute that variable, we can get the stack frame to show up with any desired name. This uses this trick to allow the list of processes to be given names, and these names are used in the calls.
Based on some quick local benchmarking there doesn't seem to be any measurable difference in performance with this. I've kicked off a touchstone run on plietar/malariasimulation#13, waiting for results. |
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.
Thanks for figuring that out!
Note: we would want to update dev too. |
Yeah that was definitely aimed at dev, I keep forgetting to set the right target branch |
Thanks to [individual#198], processes in the simulation can now be named. This has no effect on the behaviour of the simulation but helps in debugging and profiling by labelling the call frames with the given names. While at it, I've fixed a typo in the name of the prevalence renderer. [individual#198]: mrc-ide/individual#198
Thanks to [individual#198], processes in the simulation can now be named. This has no effect on the behaviour of the simulation but helps in debugging and profiling by labelling the call frames with the given names. While at it, I've fixed a typo in the name of the prevalence renderer. [individual#198]: mrc-ide/individual#198
Thanks to [individual#198], processes in the simulation can now be named. This has no effect on the behaviour of the simulation but helps in debugging and profiling by labelling the call frames with the given names. While at it, I've fixed a typo in the name of the prevalence renderer. [individual#198]: mrc-ide/individual#198
Thanks to [individual#198], processes in the simulation can now be named. This has no effect on the behaviour of the simulation but helps in debugging and profiling by labelling the call frames with the given names. [individual#198]: mrc-ide/individual#198
Because of how R assigns names to stack frames, all processes in a typical individual simulation would end up being called
p
. This makes it difficult to interpret profiling results.R uses the name of the variable the called function is bound to. By dynamically creating a variable with a chosen name and using
eval
to execute that variable, we can get the stack frame to show up with any desired name.This uses this trick to allow the list of processes to be given names, and these names are used in the calls.
Below is a comparison of the before and after of looking at a malariasimulation profile. Instead of everything being grouped under a single
p
node, there are now distinct nodes for each process.