This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | amaury.forgeotdarc |
|---|---|
| Recipients | amaury.forgeotdarc, belopolsky, benjamin.peterson, christian.heimes, collinwinter, jyasskin, ncoghlan, nnorwitz, rhettinger |
| Date | 2008年03月06日.15:53:59 |
| SpamBayes Score | 0.30632168 |
| Marked as misclassified | No |
| Message-id | <1204818841.82.0.38885303536.issue2179@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
> What's strange is that calling __enter__ and __exit__ in a > try/finally block brings the speed back to the faster 'with' speed, > even though they call the same C functions Looking carefully at the code, there are two reasons for this: - LockType has no methods! try "dir(thread.LockType)". Instead, LockType defines a tp_getattr which does a *linear* search in a PyMethodDef array. First items are served faster... - After converting this to use the usual tp_methods slot, there is still a performance difference, due to the fact that release() is a METH_NOARGS method, while __exit__() uses METH_VARARGS. Phew. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年03月06日 15:54:02 | amaury.forgeotdarc | set | spambayes_score: 0.306322 -> 0.30632168 recipients: + amaury.forgeotdarc, nnorwitz, collinwinter, rhettinger, ncoghlan, belopolsky, christian.heimes, jyasskin, benjamin.peterson |
| 2008年03月06日 15:54:01 | amaury.forgeotdarc | set | spambayes_score: 0.306322 -> 0.306322 messageid: <1204818841.82.0.38885303536.issue2179@psf.upfronthosting.co.za> |
| 2008年03月06日 15:54:00 | amaury.forgeotdarc | link | issue2179 messages |
| 2008年03月06日 15:53:59 | amaury.forgeotdarc | create | |