diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-06-07 23:20:37 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-06-07 23:28:01 +0200 |
commit | def0f73989047c4ddf9b11da05ad2c9c8e387331 (patch) | |
tree | 0b5afab413885df75a31d36d430a5a5323aaeaa9 /test/git/async/test_pool.py | |
parent | be06e87433685b5ea9cfcc131ab89c56cf8292f2 (diff) | |
download | gitpython-def0f73989047c4ddf9b11da05ad2c9c8e387331.tar.gz |
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
Diffstat (limited to 'test/git/async/test_pool.py')
-rw-r--r-- | test/git/async/test_pool.py | 8 |
1 files changed, 6 insertions, 2 deletions
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 |