From def0f73989047c4ddf9b11da05ad2c9c8e387331 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 7 Jun 2010 23:20:37 +0200 Subject: introduced a new counter keeping track of the scheduled tasks - this prevent unnecessary tasks to be scheduled as we keep track of how many items will be produced for the task at hand. This introduces additional locking, but performns well in multithreaded mode. Performance of the master queue is still a huge issue, its currently the limiting factor, as bypassing the master queue in serial moode gives 15x performance, wich is what I would need --- test/git/async/test_pool.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/git/async/test_pool.py') diff --git a/test/git/async/test_pool.py b/test/git/async/test_pool.py index 2b45727c..29c13188 100644 --- a/test/git/async/test_pool.py +++ b/test/git/async/test_pool.py @@ -36,7 +36,7 @@ class TestThreadTaskNode(InputIteratorThreadTask): self.plock.release() super(TestThreadTaskNode, self).process(count) - def _assert(self, pc, fc): + def _assert(self, pc, fc, check_scheduled=False): """Assert for num process counts (pc) and num function counts (fc) :return: self""" self.plock.acquire() @@ -49,6 +49,10 @@ class TestThreadTaskNode(InputIteratorThreadTask): print self.item_count, fc assert self.item_count == fc self.lock.release() + + # if we read all, we can't really use scheduled items + if check_scheduled: + assert self._scheduled_items == 0 assert not self.error() return self @@ -184,7 +188,7 @@ class TestThreadPool(TestBase): else: assert rc.read(1)[0] == i # END for each item - task._assert(ni / task.min_count + 1, ni) + task._assert(ni / task.min_count, ni) del(rc) assert p.num_tasks() == null_tasks -- cgit v1.2.1