I did go multithread by scheduling the independent steps like this
(untested pseudocode follows :-)
I'm going by memory... sorry for errors)
[modelActions createActionForEach: agentsList message(step1)]
[modelActions createActionForEach: agentsList message(step2)]
You might want to check if making the following change speeds things
up at all. Instead of writing
[modelActions createActionForEach: agentsList message(step1)]
[modelActions createActionForEach: agentsList message(step2)]
put
[modelActions createAction: self message(fooBar)]
(the right message might not be createAction... it's been a long time
since I've used Swarm)
and then in the class file define fooBar as follows:
- (void) fooBar() {
// loop over agentsList using standard iterator techniques, calling
step1 for each
// loop over agentsList using standard iterator techniques, calling
step2 for each
}
Introducing the above change into my code sped up one model by a
factor of 10. Of course, in my case the slowdown was due to Swarm's
message-passing methods in createActionForEach when the list contains
heterogeneous agents. In your case, I would guess the forks(), etc.
are much more of a bottleneck than Swarm's message-passing methods.
Cheers,
Jason