SVNKit clean revert: 84 seconds to 5 (94% less time)

I investigated slow revert and update in a Jenkins job with 294,711 versioned paths. Command-line SVN was much faster on the same machine. I have attached nine small patches for review, including tests.

The revert changes keep temporary database writes together instead of saving them for every file. They also avoid repeated work after checking that the whole working copy is unchanged.

The update changes read information once and reuse it instead of looking it up again for each file. Two SQLJet patches let SVNKit read only the fields it needs.

These were the observed times on the same Linux machine, using local XFS storage, Java 17 and command-line SVN 1.14.1:

Operation Original SVNKit, one run Changed code, repeated runs Command-line SVN, repeated runs
Revert an unchanged working copy 83.94 seconds 5.00 seconds 4.54 seconds
Update with no incoming changes 35.58 seconds 7.00 seconds 1.98 seconds

The repeated revert and command-line figures are the middle of five runs. Revert timings include starting Java each time. For the changed update, I kept Java running, ran three practice updates, then took the middle of 12 runs. The original SVNKit figures are single runs. Before and after update figures therefore have different starting conditions. Update tests used the same external SSH command for SVNKit and command-line SVN.

Revert is close to command-line speed in this case. Update is still about 3.5 times slower, so that part is unfinished. I have not measured a new checkout or a full-size update that brings in changes.

The patches are grouped into three sets:

  • revert/: two SVNKit patches. These can be reviewed separately from the update work.
  • sqljet/: two SQLJet patches.
  • update/: five SVNKit patches. The last one needs the first SQLJet patch and will not build with released SQLJet 1.1.15 alone.

The SVNKit patches start from master commit 24a6efc9ca98c26d05b3f0e10acd5b86d19ceafd. The SQLJet patches start from branches/1.1.x at revision 1350. The original runtime used SVNKit 1.10.11 and SQLJet 1.1.15. I also checked SVNKit 1.10.13; the working-copy code was unchanged.

The faster whole-copy revert check currently needs Linux, JNA and working-copy format 31. Other cases keep the existing revert code. The new SQLJet cursor method also needs changes in outside implementations of ISqlJetCursor before release.

All 62 selected SQLJet tests passed. The SVNKit update, move and external tests had 52 passes and three skips. The local revert tests had five passes and one Linux-only skip on macOS. The revert code also passed checks on Linux for changed and missing files, cancellation and permissions.

Would you consider these changes? Feedback on the remaining update time and the SQLJet method change would be useful.
svnkit-performance-patches.zip (48.6 KB)