quakeforge/libs/ecs/test/Makemodule.am
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

57 lines
1.5 KiB
Text

libs_ecs_tests = \
libs/ecs/test/test-components \
libs/ecs/test/test-compops \
libs/ecs/test/test-hierarchy \
libs/ecs/test/test-registry \
libs/ecs/test/test-subpools \
libs/ecs/test/test-treehierarchy
TESTS += $(libs_ecs_tests)
check_PROGRAMS += $(libs_ecs_tests)
libs_ecs_test_libs= \
libs/ecs/libQFecs.la \
libs/util/libQFutil.la
libs_ecs_test_test_components_SOURCES= \
libs/ecs/test/test-components.c
libs_ecs_test_test_components_LDADD= \
$(libs_ecs_test_libs)
libs_ecs_test_test_components_DEPENDENCIES= \
$(libs_ecs_test_libs)
libs_ecs_test_test_compops_SOURCES= \
libs/ecs/test/test-compops.c
libs_ecs_test_test_compops_LDADD= \
$(libs_ecs_test_libs)
libs_ecs_test_test_compops_DEPENDENCIES= \
$(libs_ecs_test_libs)
libs_ecs_test_test_hierarchy_SOURCES= \
libs/ecs/test/test-hierarchy.c
libs_ecs_test_test_hierarchy_LDADD= \
$(libs_ecs_test_libs)
libs_ecs_test_test_hierarchy_DEPENDENCIES= \
$(libs_ecs_test_libs)
libs_ecs_test_test_registry_SOURCES= \
libs/ecs/test/test-registry.c
libs_ecs_test_test_registry_LDADD= \
$(libs_ecs_test_libs)
libs_ecs_test_test_registry_DEPENDENCIES= \
$(libs_ecs_test_libs)
libs_ecs_test_test_subpools_SOURCES= \
libs/ecs/test/test-subpools.c
libs_ecs_test_test_subpools_LDADD= \
$(libs_ecs_test_libs)
libs_ecs_test_test_subpools_DEPENDENCIES= \
$(libs_ecs_test_libs)
libs_ecs_test_test_treehierarchy_SOURCES= \
libs/ecs/test/test-treehierarchy.c
libs_ecs_test_test_treehierarchy_LDADD= \
$(libs_ecs_test_libs)
libs_ecs_test_test_treehierarchy_DEPENDENCIES= \
$(libs_ecs_test_libs)