diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-12-20 18:21:53 -0600 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-12-20 18:29:10 -0600 |
| commit | 9b8f038a97477a93ae7c7860ebfdcda0b85ed538 (patch) | |
| tree | d34587f944a8ba5a55f8f97abd04320825261bee /src/flake8 | |
| parent | 109f5f8888fc6c3b2a82e617af46ed5bc00f8435 (diff) | |
| download | flake8-9b8f038a97477a93ae7c7860ebfdcda0b85ed538.tar.gz | |
Tidy up last few bits for performance improvement
Diffstat (limited to 'src/flake8')
| -rw-r--r-- | src/flake8/checker.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/flake8/checker.py b/src/flake8/checker.py index e0fa832..4cd049d 100644 --- a/src/flake8/checker.py +++ b/src/flake8/checker.py @@ -92,11 +92,6 @@ class Manager(object): raise self.using_multiprocessing = False - @staticmethod - def _cleanup_queue(q): - while not q.empty(): - q.get_nowait() - def _process_statistics(self): for checker in self.checkers: for statistic in defaults.STATISTIC_NAMES: @@ -279,10 +274,15 @@ class Manager(object): """Run the checkers in parallel.""" final_results = collections.defaultdict(list) final_statistics = collections.defaultdict(dict) - for ret in self.pool.imap_unordered( - _run_checks, self.checkers, - chunksize=_pool_chunksize(len(self.checkers), self.jobs), - ): + pool_map = self.pool.imap_unordered( + _run_checks, + self.checkers, + chunksize=calculate_pool_chunksize( + len(self.checkers), + self.jobs, + ), + ) + for ret in pool_map: filename, results, statistics = ret final_results[filename] = results final_statistics[filename] = statistics @@ -620,7 +620,7 @@ def _pool_init(): signal.signal(signal.SIGINT, signal.SIG_IGN) -def _pool_chunksize(num_checkers, num_jobs): +def calculate_pool_chunksize(num_checkers, num_jobs): """Determine the chunksize for the multiprocessing Pool. - For chunksize, see: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.imap # noqa |
