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 | rhettinger |
|---|---|
| Recipients | amaury.forgeotdarc, georg.brandl, ggenellina, inducer, rhettinger, tim.peters |
| Date | 2007年11月27日.18:41:57 |
| SpamBayes Score | 0.0005899358 |
| Marked as misclassified | No |
| Message-id | <1196188918.5.0.0303547731685.issue1045@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
FWIW, the 2.4 to 2.5 timing difference came from renaming __len__ to __length_hint__. This was at Guido's request so that the value of bool (iter(obj)) would always be True. The consequence of the change was that we lost the fast slot lookup for __len__ and instead have to do a dictionary based attribute lookup. For the most part, I don't care about the overhead as it is constant. The inner-loop cost dominates. If you do care, the choices are to add some ugly, hackish specific type checks to bypass the attribute lookup in cases like generator objects where we know the type is absent. A more general, cleaner solution is to add a new slot for a length hint. Personally, I would rather leave this as is and live with the small constant lookup time. If you concur, please close this report. If not, please submit a patch for adding a new slot (model the code after that in PyObject_Size()). |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2007年11月27日 18:41:58 | rhettinger | set | spambayes_score: 0.000589936 -> 0.0005899358 recipients: + rhettinger, tim.peters, georg.brandl, amaury.forgeotdarc, ggenellina, inducer |
| 2007年11月27日 18:41:58 | rhettinger | set | spambayes_score: 0.000589936 -> 0.000589936 messageid: <1196188918.5.0.0303547731685.issue1045@psf.upfronthosting.co.za> |
| 2007年11月27日 18:41:58 | rhettinger | link | issue1045 messages |
| 2007年11月27日 18:41:57 | rhettinger | create | |