[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-07-13 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: % ./python.exe -mtimeit 'isinstance(3, int)' 100 loops, best of 3: 0.269 usec per loop % ../release25-maint/python.exe -mtimeit 'isinstance(3, int)'100 loops, best of 3: 0.335 usec per loop So I'd say its no longer 4x slower these d

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-07-09 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: Does anyone care about this still? I added some comments on http://codereview.appspot.com/504 ___ Python tracker <[EMAIL PROTECTED]> ___

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-04-02 Thread Thomas Heller
Thomas Heller <[EMAIL PROTECTED]> added the comment: Issue #2534 has a patch which speeds up isinstance and issubclass by implementing type.__instancecheck__ and type.__subclasscheck__. __ Tracker <[EMAIL PROTECTED]>

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-18 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Attaching a small patch to speed-up one easy case. -- keywords: +patch Added file: http://bugs.python.org/file9742/isinst.diff __ Tracker <[EMAIL PROTECTED]> _

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-18 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: No doubt it would take some work. IMO, code for a slot is worth it; otherwise, many apps will have to pay the price for ABCs even if they don't use the feature. For my company, that would deter an upgrade to 2.6.

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-18 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: Yeah, but tp_ slots are expensive themselves (mostly in the amount of code that needs to be changed -- see typeobject.c). __ Tracker <[EMAIL PROTECTED]>

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-18 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: The attribute lookup cost can mostly be eliminated if __instancecheck__ were given a tp slot. -- nosy: +rhettinger __ Tracker <[EMAIL PROTECTED]> _

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-18 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: Perhaps, though I'm not sure if that doesn't slow things down further due to the complicated protocol for calling it. Also, there's a recursion check in the built-in implementation. __ Tracker <[EMAIL PROTEC

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-18 Thread Thomas Heller
Thomas Heller <[EMAIL PROTECTED]> added the comment: Would it help to implement a default __instancecheck__ and __subclasscheck__ for object (or for type), that subclasses can override? -- nosy: +theller __ Tracker <[EMAIL PROTECTED]>

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-17 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: I'll set this to critical to ensure that I look at it at least once before we release. I'm not sure however that we can do much about it -- nor that it matters much in practice. Perhaps we could speed up certain common isinstance() calls b

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-16 Thread Georg Brandl
Changes by Georg Brandl <[EMAIL PROTECTED]>: -- type: behavior -> performance __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing lis

[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-03-16 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin <[EMAIL PROTECTED]>: r58099 added an exception to the common case of PyObject_IsInstance(), when the class has no __instancecheck__ attribute. This makes isinstance(3, int) take 4x as long as in python 2.5. -- assignee: gvanrossum components: Interpret