chiark / gitweb /
peerdb/tripe-newpeers.in: Fix memoization while resolving inheritance.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 27 May 2018 01:28:20 +0000 (02:28 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 14 Jun 2018 11:50:38 +0000 (12:50 +0100)
commit886350e8acb1116bf39bec5e5c411cc1db377d31
treeb193d19b59e6b36f858276297aa1b8c7f214fc0d
parent4251f8ad09fe48e87afd36a172649250c48acd94
peerdb/tripe-newpeers.in: Fix memoization while resolving inheritance.

The memoization never worked properly.  It's clear, because the code
tries to store old values in the `map' dictionary, that it /wants/ to
optimize repeated visits to the same parent section, but unfortunately
nothing actually picks these saved values up again.  I can't tell any
more, but I think this is because the memoization map never stored the
path, so a second visit would return an unhelpful truncated path.

Also, the per-lookup memoization isn't really very effective: we
pointlessly walk the inheritance graph afresh for each `get' call.

Replace this with a per-section cache of inheritance-resolved lookups,
complete with path information.
peerdb/tripe-newpeers.in