~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_dirstate.py

  • Committer: Vincent Ladeuil
  • Date: 2009-06-22 15:39:42 UTC
  • mto: (4471.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4472.
  • Revision ID: v.ladeuil+lp@free.fr-20090622153942-aorq8hfs6en444fx
Fix failing benchmarks for dirstate helpers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
            state.unlock()
195
195
 
196
196
    def test__read_dirblocks_20k_tree_0_parents_py(self):
197
 
        from bzrlib._dirstate_helpers_py import _read_dirblocks_py
 
197
        from bzrlib._dirstate_helpers_py import _read_dirblocks
198
198
        state = self.build_20k_dirstate()
199
199
        state.lock_read()
200
200
        try:
201
201
            self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
202
202
                             state._dirblock_state)
203
203
            state._read_header_if_needed()
204
 
            self.time(_read_dirblocks_py, state)
 
204
            self.time(_read_dirblocks, state)
205
205
        finally:
206
206
            state.unlock()
207
207
 
208
 
    def test__read_dirblocks_20k_tree_0_parents_c(self):
 
208
    def test__read_dirblocks_20k_tree_0_parents_pyx(self):
209
209
        self.requireFeature(CompiledDirstateHelpersFeature)
210
210
        from bzrlib._dirstate_helpers_pyx import _read_dirblocks
211
211
        state = self.build_20k_dirstate()
230
230
        finally:
231
231
            state.unlock()
232
232
 
233
 
    def test__read_dirblocks_20k_tree_1_parent_c(self):
 
233
    def test__read_dirblocks_20k_tree_1_parent_pyx(self):
234
234
        self.requireFeature(CompiledDirstateHelpersFeature)
235
235
        from bzrlib._dirstate_helpers_pyx import _read_dirblocks
236
236
        state = self.build_20k_dirstate_with_parents(1)
255
255
        finally:
256
256
            state.unlock()
257
257
 
258
 
    def test__read_dirblocks_20k_tree_2_parents_c(self):
 
258
    def test__read_dirblocks_20k_tree_2_parents_pyx(self):
259
259
        self.requireFeature(CompiledDirstateHelpersFeature)
260
260
        from bzrlib._dirstate_helpers_pyx import _read_dirblocks
261
261
        state = self.build_20k_dirstate_with_parents(2)
313
313
        self.assertEqualDiff(expected_str, offset_str)
314
314
 
315
315
    def test_bisect_dirblock_py(self):
316
 
        from bzrlib._dirstate_helpers_py import bisect_dirblock_py
 
316
        from bzrlib._dirstate_helpers_py import bisect_dirblock
317
317
        state = self.build_10k_dirstate_dirs()
318
318
        state.lock_read()
319
319
        try:
320
320
            self.setup_paths_and_offsets(state)
321
321
            offsets = self.time(self.do_bisect_list,
322
 
                                bisect_dirblock_py)
 
322
                                bisect_dirblock)
323
323
            self.checkOffsets(offsets)
324
324
        finally:
325
325
            state.unlock()
326
326
 
327
327
    def test_bisect_dirblock_cached_py(self):
328
 
        from bzrlib._dirstate_helpers_py import bisect_dirblock_py
 
328
        from bzrlib._dirstate_helpers_py import bisect_dirblock
329
329
        state = self.build_10k_dirstate_dirs()
330
330
        state.lock_read()
331
331
        try:
332
332
            self.setup_paths_and_offsets(state)
333
333
            offsets = self.time(self.do_bisect_list_cached,
334
 
                                bisect_dirblock_py)
 
334
                                bisect_dirblock)
335
335
            self.checkOffsets(offsets)
336
336
        finally:
337
337
            state.unlock()
338
338
 
339
 
    def test_bisect_dirblock_c(self):
 
339
    def test_bisect_dirblock_pyx(self):
340
340
        self.requireFeature(CompiledDirstateHelpersFeature)
341
 
        from bzrlib._dirstate_helpers_pyx import bisect_dirblock_c
 
341
        from bzrlib._dirstate_helpers_pyx import bisect_dirblock
342
342
        state = self.build_10k_dirstate_dirs()
343
343
        state.lock_read()
344
344
        try:
345
345
            self.setup_paths_and_offsets(state)
346
 
            offsets = self.time(self.do_bisect_list, bisect_dirblock_c)
 
346
            offsets = self.time(self.do_bisect_list, bisect_dirblock)
347
347
            self.checkOffsets(offsets)
348
348
        finally:
349
349
            state.unlock()
415
415
 
416
416
    def test_cmp_by_dirs_py(self):
417
417
        """Benchmark 103041 comparisons."""
418
 
        from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
419
 
        self.compareAllPaths(cmp_by_dirs_py,
 
418
        from bzrlib._dirstate_helpers_py import cmp_by_dirs
 
419
        self.compareAllPaths(cmp_by_dirs,
420
420
                             [(3, 1), (3, 1), (3, 1), (3, 2)])
421
421
 
422
422
    def test_cmp_by_dirs_pyrex(self):
423
423
        self.requireFeature(CompiledDirstateHelpersFeature)
424
 
        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs_c
425
 
        self.compareAllPaths(cmp_by_dirs_c,
 
424
        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
 
425
        self.compareAllPaths(cmp_by_dirs,
426
426
                             [(3, 1), (3, 1), (3, 1), (3, 2)])