Closed Sirorezka closed 5 years ago
Multithreading performance could be increased:
Don't generate agents if they are not in thread: rewrite: ProcessorGroup.insert_or_append:
for i_id, ap in enumerate(agent_parameters, maxid): agent_name = (agent_arguments['group'],i_id) if hash(agent_name) % self.processes == self.batch: agent = Agent(i_id, simulation_parameters, ap, **agent_arguments) agent._send = agent._send_multiprocessing ## send method is rewriten agent._out = defaultdict(list) agent.init(**ChainMap(simulation_parameters, ap)) assert agent.name not in self.agents, agent.name agent._str_name = re.sub('[^0-9a-zA-Z_]', '', str(agent.name)) names[agent.name] = agent.name agent._processes = self.processes self.agents[agent.name] = agent
@Sirorezka agreed. I have observed this as well. Thanks for finding this out!
Multithreading performance could be increased:
Don't generate agents if they are not in thread: rewrite: ProcessorGroup.insert_or_append: