Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop using queue #6

Open
xmcp opened this issue Aug 25, 2016 · 1 comment
Open

stop using queue #6

xmcp opened this issue Aug 25, 2016 · 1 comment

Comments

@xmcp
Copy link

xmcp commented Aug 25, 2016

queue is designed for multithreading uses and acquire a lock in every method call. in a word, it's really slow.

just use list instead. it's much (about 50x) faster.

>>> import timeit
>>> timeit.timeit('q.put(123)', 'import queue; q=queue.Queue()', number=10**6)
24.48412793993996
>>> timeit.timeit('q.append(123)', 'q=[]', number=10**6)
0.5576901608900329
@jeffswt
Copy link
Owner

jeffswt commented Feb 12, 2017

Since this class had been recently removed due to a potential rewrite, I will take this suggestion into consideration with the utmost importance.

I personally believe that writing a class (not thread-safe) by myself would be a better option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants