quakeforge/libs/ecs/test
Bill Currie 0360e33a00 [ecs] Add "tree mode" to hierarchies
As I had long suspected, building large hierarchies is fiendishly
expensive (at least O(N^2)). However, this is because the hierarchies
are structured such that adding high-level nodes results in a lot of
copying due to the flattened (breadth-first) layout (which does make for
excellent breadth-first performance when working with a hierarchy).

Using tree mode allows adding new nodes to be O(1) (I guess O(N) for the
size of the sub-tree being added, but that's not supported yet) and
costs only an additional 8 bytes per node. Switching from flat mode to
tree mode is very cheap as only the additional tree-related indices need
to be fixed up (they're almost entirely ignored in flat mode). Switching
from tree to flat mode is a little more expensive as the entire tree
needs to be copied, but it seems to be an O(N) (size of the tree).

With this, building the style editor window went from about 25% to about
5% (and most of that is realloc!), with a 1.3% cost for switching from
tree mode to flat mode.

There's still a lot of work to do (supporting removal and tree inserts).
2023-07-07 14:42:49 +09:00
..
Makemodule.am [ecs] Add "tree mode" to hierarchies 2023-07-07 14:42:49 +09:00
test-components.c [ecs] Split component registration from pool creation 2022-12-13 22:58:44 +09:00
test-compops.c [ecs] Add a component rotation function 2023-07-03 01:40:26 +09:00
test-hierarchy.c [ecs] Plug a bunch of memory leaks 2023-03-05 22:03:01 +09:00
test-registry.c [ecs] Split component registration from pool creation 2022-12-13 22:58:44 +09:00
test-subpools.c [ecs] Adjust subpool range type to return start,end 2022-12-20 17:56:08 +09:00
test-treehierarchy.c [ecs] Add "tree mode" to hierarchies 2023-07-07 14:42:49 +09:00