GH-2382 - Track engine instances in a Set rather than a List

The collection of active interpreters is removed from randomly - as each one completes. This results in random removals from the linked list, a O(n) operation.

As the number of active interpreters grows, so does this time. This happens within a synchronized block, which can stall the work of other threads when a model is shared across threads for reads.
1 file changed