]> dreyeck.freedombox.rocks Git - topic-maps.git/commitdiff
perf(tmdm): index topic normalization merge candidates
authorrgb <ralf.barkow@me.com>
Wed, 28 Oct 2026 06:01:47 +0000 (07:01 +0100)
committerrgb <ralf.barkow@me.com>
Wed, 28 Oct 2026 06:01:47 +0000 (07:01 +0100)
normalize-topic-map chose the next pair of Topics to merge by comparing
all Topic pairs; each pair without a shared identifier called
topic-reified, which enumerates every information item. Reading the
1,855-line HyperDoc project CTM did not finish in 120 s.

next-topic-merge returns the same pair through an index built for one
search and dropped with it: identifier keys (item and subject identifiers
in one namespace, subject locators apart) and a table of reified items for
the nonconflicting-reifier preference. A Topic that reifies two items, or
a listed Topic that is not its own representative, falls back to
scan-next-topic-merge, the unchanged pairwise search, so the conditions
and the moment they are signalled stay as they were. Nothing outlives a
call, so no invalidation rule exists.

The project CTM now reads in about 29-31 s (median of three fresh runs in
two independent reproductions); its semantic signature and CXTM are
byte-identical to the 5a4a668 reference. The Association pair search is
the remaining cost and is left unchanged.

tests/normalization-index.lisp (120 checks): CXTM and rejection outcomes
recorded from unchanged b2eecffa, staged-import reifier preference,
retained handles, index-versus-pairwise comparison on random maps, merge
walks and CTM documents, stale references, a positive control and scale.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

No differences found