Optimize diff/post performance by caching 'svn info' results
Review Request #7199 — Created April 13, 2015 and submitted — Latest diff uploaded
rbt diff and post operations make numerous calls to 'svn info' with
paths to various files. For any given modified file, 'svn info'
is called 4 + N times. This breaks down as:
- 3 calls from convert_to_absolute_paths() with the full filename
to process the new file line, original file line, and Index line - 1 call from find_copyfrom() for the full filename
- N calls from find_copyfrom() for each sub-path component in the
filename
By introducing caching on results from 'svn info' the number of
calls per file can be decreased to 1 + M, where M is always <= N.
For files sharing a common directory hierarchy, M will be equal
to N for the first file processed and 0 for all subsequent files.
Consider a contrived example with two modified files at:
A/B/C/foo.txt
A/B/C/bar.txt
The original code make 14 total calls to 'svn info'. Measuring
timing on a CentOS 7 box with time -p
reveals an average run
time of 0.742s. The updated code makes 5 total calls to
'svn info' and runtime is measured at 0.586s. This is a decrease
in runtime of 21%.
* Performed various 'rbt diff' executions with debug enabled to verify expected decrease in calls to 'svn info'. * Ran unit tests.