Closed plietar closed 4 months ago
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 https://github.com/plietar/malariasimulation/pull/13, waiting for results.
Note: we would want to update dev too.
Yeah that was definitely aimed at dev, I keep forgetting to set the right target branch
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.