Parallel query executing sequentially

Started by
0 comments, last by Narf the Mouse 11 years, 10 months ago
The .Where( ) function in the following code is executing in sequential; following the code in the debugger reveals only one thread. It is also, by profiling, the slowest part of my code.

models is List<Model> of 15,000 models.
Frustum is a struct.

var frustum = camera.Frustum;

var drawn = models.AsParallel( ).AsUnordered( ).Where(
model => IntersectionTests.AABBXFrustum( model.BoundingAABB, frustum )
).ToList( ) ;

If you need more information, I can provide it, but I don't see how anything not referenced in the function could be affecting it.

My question, then, is why is it executing sequentially and how do I fix it so it runs in parallel?

Thanks.
Advertisement
Never mind; a closer look shows it executing in parallel.

(You have to set a breakpoint inside the code to be executed in parallel, then F5 to that)

This topic is closed to new replies.

Advertisement