On Sun, May 20, 2012 at 5:35 PM, Stefan Fuhrmann
<stefanfuhrmann_at_alice-dsl.de> wrote:
> Hi Bert,
>
> In short: excellent work! With your latest changes,
> all algorithmic issues have been resolved as already
> confirmed on IRC. Two places in the server could
> also be improved (r1340874-5).
>
> Note to package builders: Sqlite 3.7.7 will not use
> all available indexes while 3.7.12 does (an possibly
> earlier ones). Deletion will still be slow with those
> old versions.
Should we bump the minimum required SQLite version for 1.8?
-Hyrum
>
> To illustrate how much performance improved since
> April here the original results:
>
> Processing 16384 files in the same folder
>   Creating files ...    real  user   sys
> Â Â Adding files ... Â Â Â 10.174 Â 8.317 Â 1.780
> Â Â Running status ... Â Â 0.235 Â 0.196 Â 0.036
> Â Â Commit files ... Â Â Â 19.434 Â 8.997 Â 6.116
> Â Â Listing files ... Â Â Â 0.157 Â 0.064 Â 0.012
> Â Â Updating files ... Â Â 0.312 Â 0.292 Â 0.012
> Â Â Local copy ... Â Â Â Â 5228.840 Â 4998.244 Â 215.085
> Â Â Commit copy ... Â Â Â Â 3.398 Â 2.304 Â 1.012
> Â Â Delete 1 file ... Â Â Â 0.275 Â 0.260 Â 0.012
> Â Â Deleting files ... Â Â 5025.387 Â 4521.755 Â 455.236
> Â Â Commit deletions ... Â Â 1681.892 Â 1508.402 Â 94.458
> Â Â Export all ... Â Â Â 1.758 Â 1.012 Â 0.720
> Â Â Check out all ... Â Â Â 17.582 Â 9.533 Â 7.828
>
> Now look at HEAD results:
>
> Processing 16384 files in the same folder
>   Creating files ...    real  user   sys
> Â Â Adding files ... Â Â Â 9.590 Â 7.896 Â 1.620
> Â Â Running status ... Â Â 0.135 Â 0.084 Â 0.048
> Â Â Commit files ... Â Â Â 14.130 Â 5.676 Â 4.908
> Â Â Listing files ... Â Â Â 0.105 Â 0.036 Â 0.012
> Â Â Updating files ... Â Â 0.267 Â 0.244 Â 0.016
> Â Â Local copy ... Â Â Â Â 10.023 Â 5.344 Â 4.592
> Â Â Commit copy ... Â Â Â Â 0.675 Â 0.568 Â 0.064
> Â Â Delete 1 file ... Â Â Â 0.009 Â 0.004 Â 0.004
> Â Â Deleting files ... Â Â 6.686 Â 4.892 Â 1.744
> Â Â Commit deletions .. Â Â 17.530 Â 4.016 Â 2.320
> Â Â Export all ... Â Â Â 1.259 Â 0.604 Â 0.632
> Â Â Check out all ... Â Â Â 14.026 Â 6.640 Â 7.236
>
> (some ra_svn improvements can be seen in list,
> export and such).
>
> -- Stefan^2.
>
> Bert Huijben wrote:
>>
>>
>>> -----Original Message-----
>>> From: Stefan Fuhrmann [mailto:stefanfuhrmann_at_alice-dsl.de]
>>> Sent: zaterdag 19 mei 2012 20:34
>>> To: Subversion Development
>>> Subject: Working copy operations that are worse than O(change size)
>>>
>>> Hi Bert& Â interested parties,
>>>
>>>
>>> as promised, I ran the create_bigdir.sh benchmark with the
>>> latest commit harvester improvements (r1340484). Â While
>>> I do see some speedup, the following operations have runtime
>>> that is not proportional to the size of the change, Â i.e. they
>>> exhibit O(n^2) behavior.
>>>
>>> All statements are run in directories that are directly below
>>> the WC root and contain(ed) no sub-directories.
>>>
>>> * svn cp WC/dir1 WC/dir2
>>> Â Â because STMT_INSERT_WORKING_NODE_COPY_FROM_BASE
>>> Â Â is O(entries in dir1)
>>
>> This query was O(entries-in-wc). This query is O(n) now.
>> (It is evaluated for every node that is copied)
>>
>>> * svn del WC/dir/file
>>> Â Â because STMT_HAS_SERVER_EXCLUDED_NODES
>>
>> This query is no longer evaluated for files that are deleted; only for
>> BASE
>> directories that are deleted.
>> And this query properly uses an index now.
>>
>>> Â Â STMT_INSERT_DELETE_LIST
>>
>> I have an alternative implementation that should be more efficient if I
>> look
>> at the query plan, but my measurements don't show a difference.
>>
>> /* This matches the selection in STMT_INSERT_DELETE_FROM_NODE_RECURSIVE.
>> Â Â A subquery is used instead of nodes_current to avoid a table scan */
>> -- STMT_INSERT_DELETE_LIST
>> INSERT INTO delete_list(local_relpath)
>> SELECT local_relpath FROM nodes AS n
>> WHERE wc_id = ?1
>> Â AND (local_relpath = ?2
>> Â Â Â Â OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
>> Â AND op_depth>= ?3
>> Â AND op_depth = (SELECT MAX(s.op_depth) FROM nodes AS s
>> Â Â Â Â Â Â Â Â Â WHERE s.wc_id = ?1
>> Â Â Â Â Â Â Â Â Â Â AND s.local_relpath = n.local_relpath)
>> Â AND presence NOT IN ('base-deleted', 'not-present', 'excluded',
>> 'absent')
>>
>> This one uses the right index, while the current one doesn't.
>>
>> It appears that for me most time is spend in the INSERT part; not in the
>> SELECT.
>> (Even if I change it to a simple INSERT, the profiled result is the same)
>>
>>> Â Â STMT_DELETE_NODES_RECURSIVE
>>
>> Split in two queries. Uses the right index now
>>
>>> Â Â STMT_INSERT_DELETE_FROM_NODE_RECURSIVE
>>> Â Â are O(entries in dir).
>>
>> I can't find an O(nodes) behavior on this query. It does use the right
>> indexes.
>> (And the query plan contains the pristine refcount triggers)
>>>
>>> * svn ci WC/dir
>>> Â Â after deleting every single file in dir
>>> Â Â is O(files in dir ^ 2) because
>>> Â Â STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE
>>
>> This query uses an index now (was table scan)
>>
>>> Â Â is O(files in dir) in both calls of from
>>> Â Â svn_wc__db_base_get_lock_tokens_recursive()
>>> Â Â and STMT_DELETE_NODES_RECURSIVE is
>>
>> Split in two queries. The delete and relpath revert code paths use an
>> index
>> now.
>> (That leaves the wcroot revert case, which really needs a table scan)
>>
>>> Â Â O(files in dir) as well.
>>>
>>> It would be nice if these queries could be fixed for 1.8.
>>
>> I think most are fixed now :)
>>
>>
>> Most of these show huge performance improvements on large working copies,
>> but on the small working copies from our test suite a table scan is often
>> slightly faster than an index lookup, followed by looking up the actual
>> record.
>>
>> Â Â Â Â Bert
>>
>>
>
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-05-21 15:40:46 CEST