1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# Copyright (C) 2006 by Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Tests for bzr add performance."""
from bzrlib.tests.blackbox import ExternalBase
class TestAdd(ExternalBase):
def test_one_add_kernel_like_tree(self):
"""Adding a kernel sized tree should be bearable (<5secs) fast."""
# a kernel tree has ~10000 and 500 directory, with most files around
# 3-4 levels deep.
# we simulate this by three levels of dirs named 0-7, givin 512 dirs,
# and 20 files each.
# on roberts machine this originally took 25936ms/32244ms
# after quick tuning (more needed): 14640ms/19677ms
self.run_bzr('init')
files = []
for outer in range(8):
files.append("%s/" % outer)
for middle in range(8):
files.append("%s/%s/" % (outer, middle))
for inner in range(8):
prefix = "%s/%s/%s/" % (outer, middle, inner)
files.append(prefix)
files.extend([prefix + str(foo) for foo in range(20)])
self.build_tree(files)
self.time(self.run_bzr, 'add')
|