sapling/eden/mononoke/hooks
Thomas Orozco fec12c95f1 mononoke/hooks: compute the changeset id once, be O(N) as opposed to O(N^2)
Summary:
Unfortunately, `BonsaiChangeset::get_changeset_id()` is a fairly expensive
operation, since it'll clone, serialize, and hash the changeset. In hooks in
particular, since we run this once per hook execution (and therefore once per
file), that can be come a problem.

Indeed, on a commit with 1K file changes, hooks run for ~30 seconds
(P129058164). According to perf, the overwhelming majority of that time is
spent in computing hashes of bonsai changesets. For a commit with 10K changes,
it spends time there as well, it took 3.5 hours.

This diff updates hooks to compute the changeset id just once, which brings our
time down to O(N) (where N = file changes).

Reviewed By: StanislavGlebik

Differential Revision: D21039811

fbshipit-source-id: 73f9939ffc7d095e717bdb5efc46dbf4ad312c65
2020-04-15 06:29:50 -07:00
..
content-stores/src Delete HgChangeset hook handling completely 2020-04-11 04:26:37 -07:00
hooks-tests/src mononoke/metaconfig: include the repository hgsql name in the config 2020-04-14 10:26:10 -07:00
src mononoke/hooks: compute the changeset id once, be O(N) as opposed to O(N^2) 2020-04-15 06:29:50 -07:00