-
-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Labels
Description
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:
numagents <- 12500
testsystem <- simmer(log_level=0)
testsystem %>%
add_resource('phone',capacity=25000,queue_size=0)
workflow <- trajectory('Workflow') %>% timeout(1)
for(sfx in seq(1,numagents)) {
name <- paste('Agent',sfx,sep='-')
testsystem %>% add_generator(name,workflow,function () ceiling(runif(1,1,1200)))
}
ts <- testsystem %>% run(until=3600)
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 the check_args work, it looks like a short drop into the C++ code so it's non-obvious on how to make this faster.