[issue3001] RLock's are SLOW

2009-11-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: I've committed the latest patch in r76189. Thanks for the reviews, everyone. -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue3001] RLock's are SLOW

2009-11-08 Thread STINNER Victor
STINNER Victor added the comment: rlock4.patch looks correct and pass test_threading.py tests. -- ___ Python tracker ___ ___ Python-bu

[issue3001] RLock's are SLOW

2009-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Yes, here is a new patch adding tp_repr. -- Added file: http://bugs.python.org/file15285/rlock4.patch ___ Python tracker ___ ___

[issue3001] RLock's are SLOW

2009-11-07 Thread Gregory P. Smith
Gregory P. Smith added the comment: Can you make the C implementation's repr() show something similar to the Python implementation? -- ___ Python tracker ___ ___

[issue3001] RLock's are SLOW

2009-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is an updated patch. I addressed all review comments, except the one about acquire_restore() checking the return result of acquire(), because I think it's really a weakness in the Python implementation. -- Added file: http://bugs.python.org/file152

[issue3001] RLock's are SLOW

2009-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: > rlock_acquire_doc: "(...) return None once the lock is acquired". > That's wrong, acquire() always return a boolean (True or False). You're right, I should fix that docstring. > rlock_release(): Is the assert(self->rlock_count > 0); really required? > You're

[issue3001] RLock's are SLOW

2009-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the review. I will make the suggested modifications. http://codereview.appspot.com/150055/diff/1/4 File Modules/_threadmodule.c (right): http://codereview.appspot.com/150055/diff/1/4#newcode221 Modules/_threadmodule.c:221: return PyBool_FromLong((lo

[issue3001] RLock's are SLOW

2009-11-07 Thread STINNER Victor
STINNER Victor added the comment: rlock_acquire_doc: "(...) return None once the lock is acquired". That's wrong, acquire() always return a boolean (True or False). rlock_release(): Is the assert(self->rlock_count > 0); really required? You're checking its value few lines before. rlock_acquire

[issue3001] RLock's are SLOW

2009-11-06 Thread Gregory P. Smith
Gregory P. Smith added the comment: Reviewers: , http://codereview.appspot.com/150055/diff/1/4 File Modules/_threadmodule.c (right): http://codereview.appspot.com/150055/diff/1/4#newcode221 Modules/_threadmodule.c:221: return PyBool_FromLong((long) r); This explicit (long) cast is unnecessary.

[issue3001] RLock's are SLOW

2009-11-05 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- assignee: -> pitrou components: -Interpreter Core stage: patch review -> needs patch versions: +Python 3.2 -Python 2.7, Python 3.1 ___ Python tracker

[issue3001] RLock's are SLOW

2009-05-16 Thread Daniel Diniz
Changes by Daniel Diniz : -- stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue3001] RLock's are SLOW

2008-12-02 Thread Kevin Watters
Changes by Kevin Watters <[EMAIL PROTECTED]>: -- nosy: +kevinwatters ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mai

[issue3001] RLock's are SLOW

2008-10-08 Thread Hugh Gibson
Hugh Gibson <[EMAIL PROTECTED]> added the comment: > I doubt subclassability of RLock matters but who knows, people do code > things. I've recently done this to implement potential deadlock detection. I keep a record of the sequences of acquired locks, find unique sequences, then check for con

[issue3001] RLock's are SLOW

2008-09-22 Thread STINNER Victor
Changes by STINNER Victor <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file11172/rlock.patch ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue3001] RLock's are SLOW

2008-08-20 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Gregory, would you have an advice on #3618? -- versions: -Python 2.6, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue3001] RLock's are SLOW

2008-08-20 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: I doubt subclassability of RLock matters but who knows, people do code things. Regardless, using a C version wrapped in a simple python container class that calls the underlying C implementation's methods should be sufficient to allow sub-c

[issue3001] RLock's are SLOW

2008-08-20 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Wow, that was quick. Did you try to replace threading.RLock with your implementation, and run the tests? By the way: > - acquire() method argument "blocking" is not a keyword > - In the Python version, RLock._release_save() replaces owner and

[issue3001] RLock's are SLOW

2008-08-20 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: Oops, I forgot to update PyInit__Thread() with my new time: - Add PyType_Ready() - Register RLockType to threading dict Here is the new patch. Added file: http://bugs.python.org/file11175/rlock-v2.patch ___

[issue3001] RLock's are SLOW

2008-08-20 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: As suggested by pitrou, I wrote an implementation of RLock in C. Changes to Python version: - no debug message: i leave the message in #if 0 ... #endif - acquire() method argument "blocking" is not a keyword Notes: - RLock has no docstrin

[issue3001] RLock's are SLOW

2008-07-06 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: -- components: +Interpreter Core, Library (Lib) nosy: +gregory.p.smith priority: -> normal ___ Python tracker <[EMAIL PROTECTED]>

[issue3001] RLock's are SLOW

2008-06-21 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Le samedi 21 juin 2008 à 16:40 +, sebastian serrano a écrit : > sebastian serrano <[EMAIL PROTECTED]> added the comment: > > Running with python -O the timing gets a little closer between Lock and > RLock. This code won't be easy to impro

[issue3001] RLock's are SLOW

2008-06-21 Thread sebastian serrano
sebastian serrano <[EMAIL PROTECTED]> added the comment: Running with python -O the timing gets a little closer between Lock and RLock. This code won't be easy to improve in performance. The heaviest call is current_thread(), used at lines: 117:me = current_thread() 137:if self.__owner i

[issue3001] RLock's are SLOW

2008-06-04 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: You should investigate and try to diagnose where the speed difference comes from. ISTM the RLock class is implemented in Python while the Lock class is simply an alias to the builtin native lock type, which could explain most of the discrepanc

[issue3001] RLock's are SLOW

2008-06-03 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <[EMAIL PROTECTED]>: -- nosy: +giampaolo.rodola ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-

[issue3001] RLock's are SLOW

2008-05-29 Thread Adam Olsen
Changes by Adam Olsen <[EMAIL PROTECTED]>: -- nosy: +Rhamphoryncus ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list maili

[issue3001] RLock's are SLOW

2008-05-29 Thread Jesús Cea Avión
New submission from Jesús Cea Avión <[EMAIL PROTECTED]>: threading.RLock acquire/release is very slow. A order of magnitude higher than no reentrant threading.Lock: """ def RLockSpeed() : import time, threading t=time.time() result={} for i in xrange(100) : pass result["empty l