• Advertisement
Sign in to follow this  

Parallel query executing sequentially

This topic is 2042 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement