Opened 11 years ago

Last modified 5 years ago

#1860 new enhancement

[PATCH] Use a vector for iterating in the ComponentManager — at Version 3

Reported by: sbte Owned by:
Priority: Should Have Milestone: Backlog
Component: Simulation Keywords: patch
Cc: Patch:

Description (last modified by sbte)

Using a vector in the ComponentManager instead of a map speeds up iterating considerably. It gives me a speedup of 4ms in Gambia River (14ms->10ms) for the sim interpolation. This, however, is not the only place where the code is called, so the overall speedup might be bigger.

The downside is that you have to keep both a map and a vector of the Components, but since those are just pointers, I don't think it is a problem.

(I edited the description for the vector version of the patch. This is much faster than the list version.)

Change History (5)

comment:1 by wraitii, 11 years ago

I've been playing with that patch (modified the Vec to List in the variable names) and I haven't encountered anything to indicate it could be failing. Not sure about the speedup, but there is no reason why this wouldn't speed things up slightly.

Edit: Should test MP with that though.

Last edited 11 years ago by wraitii (previous) (diff)

comment:2 by sbte, 11 years ago

I just did some profiling, and found out that a vector is a lot faster than a list, even though I thought otherwise. I'll fix my patch.

Edit: The vector version gives a speedup of 14ms -> 10ms. MUCH faster that is

Last edited 11 years ago by sbte (previous) (diff)

comment:3 by sbte, 11 years ago

Description: modified (diff)
Summary: [PATCH] Use a list for iterating in the ComponentManager[PATCH] Use a vector for iterating in the ComponentManager
Note: See TracTickets for help on using tickets.