Configuration speed of multiple cameras in different threads

After a bit of research, here’s some extra information.

What we’re actually doing is a Discover, then a Parallel.ForEach of:

Open()
Configure()
Dispose()
Open()

Configure is just an extension method around setting a load of node values.

Why do we Dispose and Open again? It’s related to this question. Because we’ve seen some strange things, and can’t get a clear idea of exactly what settings take effect when, we disconnect and reconnect - in the hope that all the settings we’ve sent will actually work.

If I run in series, I see that discovery takes about 3.7 seconds, then for each camera:

Open() - 2.2s
Configure() - 0.1s
Dispose() - 0.5s
Open() - 2.3s

So logically, if I run in parallel, I should be able to do this in 9s. But with 5 cameras, in series it takes 29s, and in parallel 27s.

Looking at the logs, it seems to me that Open doesn’t parallelise. For example, if you have this (pseudocode):

Parallel.For { log("Open"); Open(); log("Done"); }

All the Opens start at the same time, but the Dones come back at (around) 2 second intervals.

Just to be clear: I can live with this (though it is painful when you have 9 cameras and you’re iterating during development), but if it’s not expected behaviour, I’m interested to work out what’s wrong.