> -----Original Message-----
> From: philip_at_apache.org [mailto:philip_at_apache.org]
> Sent: maandag 2 juli 2012 16:34
> To: commits_at_subversion.apache.org
> Subject: svn commit: r1356261 - in /subversion/trunk: build.conf
> subversion/include/svn_io.h subversion/libsvn_subr/io.c
> subversion/libsvn_wc/merge.c subversion/tests/libsvn_subr/
> subversion/tests/libsvn_subr/io-test.c
>
> Author: philip
> Date: Mon Jul 2 14:34:11 2012
> New Revision: 1356261
>
> URL: http://svn.apache.org/viewvc?rev=1356261&view=rev
> Log:
> Optimize merge_file_trivial() by avoiding to read the files twice by
> using a new comparison function which compares 3 files at once. Also
> add C tests for the new and existing file comparison functions in
> libsvn_subr/io.c
>
> * subversion/include/svn_io.h
> (svn_io_filesizes_three_different_p): Add new declaration
> (svn_io_files_contents_three_same_p): Add new declaration
>
> * subversion/libsvn_subr/io.c
> (svn_io_filesizes_three_different_p): Add new function in analogy
> to svn_io_filesizes_different_p().
> (contents_three_identical_p): Add new function in analogy to
> contents_identical_p().
> (svn_io_files_contents_three_same_p): Add new function in analogy
> to svn_io_files_contents_same_p.
>
> * subversion/libsvn_wc/merge.c
> (merge_file_trivial): Use the new three-file comparison functions to
> avoid reading files twice.
>
> * build.conf
> (io-test): Add the new io-test.c file to the build configuration.
>
> * subversion/tests/libsvn_subr:
> Add the executable and temporary test file folder to svn:ignore.
>
> * subversion/tests/libsvn_subr/io-test.c
> (create_test_file): Helper function to create a test data file.
> (create_comparison_candidates): Helper function to create the full
> set of test data files.
> (test_two_file_size_comparison): Test function for
> svn_io_filesizes_different_p.
> (test_two_file_content_comparison): Test function for
> svn_io_files_contents_same_p.
> (test_three_file_size_comparison): Test function for
> test_three_file_size_comparison.
> (test_three_file_content_comparison): Test function for
> svn_io_files_contents_three_same_p.
Each of these functions performs 46*46*46 = +- 97000 file comparisons.
So that adds up to a total of rougly 300000 comparisons.
This takes +- 6% of the total testsuite time on my ramdrive setup (22 seconds). Probably much larger on most other systems.
We should really simplify this function as it is very unlikely that it really catches that much errors on every testrun.
It is a nice test for incidental testing, but shouldn't be part of the standard testrun in its current form.
Bert
Received on 2012-07-02 20:31:07 CEST