I did some profiling for SVN-4832 "Authz perf regression 1.9 -> 1.10"
<https://subversion.apache.org/issue/4832>.

I updated the issue with my findings, including a sample of the debug
timings output from my debug code.

TL;DR: if an authz file specifies a large number of ACLs and a large
number of users, it is slow. Nearly all the time is used by
svn_authz__parse() calling update_user_rights() this many times:

  (total number of ACLs in the authz file) x (total number of "concrete
users" mentioned in the authz file).

This bottleneck apparently was not present in the previous
implementation (svn 1.9), but I understand other cases were slow then.
The optimization in svn 1.10 apparently optimizes for other cases but
makes things worse in these cases.

As far as I can see the "update_user_rights" code looks functionally
trivial and the problem is just the accumulated time over a huge number
of iterations of it.

I am looking to see if there is anything that can be done about speeding
it up, whether algorithmic or local optimization. If anyone can lend
insight or a hand, I know there are some users who would appreciate it.

It's in subversion/libsvn_repos/authz_parse.c: update_user_rights()
called right at the end of expand_acl_callback(), which is called right
at the end of svn_authz__parse(). In pseudo-code:

  for each of all ACLs:
    for each of all users:
      update_user_rights()

- Julian

Reply via email to