summary refs log tree commit diff
path: root/contrib
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-07-23 19:00:16 +0100
committerRichard van der Hoff <richard@matrix.org>2018-07-23 19:10:11 +0100
commit5c705f70c9489427a7985ea10ec60552965b9a1c (patch)
tree37c8277f6cb7fc7428bb1088da660f91cde0df08 /contrib
parentMerge pull request #3584 from matrix-org/erikj/use_cached (diff)
downloadsynapse-5c705f70c9489427a7985ea10ec60552965b9a1c.tar.xz
Fixes and optimisations for resolve_state_groups
First of all, fix the logic which looks for identical input state groups so
that we actually use them. This turned out to be most easily done by factoring
the relevant code out to a separate function so that we could do an early
return.

Secondly, avoid building the whole `conflicted_state` dict (which was only ever
used as a boolean flag).

Thirdly, replace the construction of the `state` dict (which mapped from keys
to events that set them), with an optimistic construction of the resolution
result assuming there will be no conflicts. This should be no slower than
building the old `state` dict, and:
  - in the conflicted case, we'll short-cut it, saving part of the work
  - in the unconflicted case, it saves rebuilding the resolution from the
    `state` dict.

Finally, do a couple of s/values/itervalues/.
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions