In order to create a log of the items flowing trough a model, I create a token for every item that is created at reset.
I have 33617 items, so I create 33617 tokens that flow
into a "Wait for Event" activity.
Here I wait for the item's OnEntering event.
Every time a new token enters this activity and so a listener to that event is created, the real time to create this event rises grows.
This is the result of a test
- To create the first 6071 listeners, 0.02 seconds are required
- To create the next 5137 listeners, 1.38 seconds are required
- To create the next 6124 listeners, 4.73 seconds are required
- To create the next 5085 listeners, 15.99 seconds are required
- To create the next 6097 listeners, 21.20 seconds are required
- To create the next 5103 listeners, 34.28 seconds are required
Seems that every time a token enters this activity, some code is executed for all the other tokens already there (e.g. all listeners are created again)
Is there a way to speed up this operation?
Thank you.