-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
add_generator performance #221
Comments
Yeap, if you use so many generators, it takes time to set them up. Most of the time is spent in:
You could bypass these functions if you know what you are doing and you understand the implications, but I don't recommend it at all. These are One thing you can do is to avoid using the pipe in loops. So use What we can do is to enhance testsystem %>%
add_generator(paste("Agent", seq_len(numagents), sep="-"),
workflow, function() ceiling(runif(1,1,1200))) so that |
Two comments:
|
Thanks, you can test it from the master branch. |
I'm not finished testing it yet but my actual simulation's (not the test one I put in above) runtime dropped to almost 10% of previous. |
If someone is using a large number of generators, the creation of the simmer object can dwarf the simulation runtime, see below for an example:
On a reasonably current Macbook, profiling shows the above example takes approximately 20 seconds to run with the majority of the time spent in
add_generator_
. Taking a look at the source, beyond thecheck_args
work, it looks like a short drop into the C++ code so it's non-obvious on how to make this faster.The text was updated successfully, but these errors were encountered: