[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2011-02-21 Thread Christos Georgiou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: This is not the proper place for it, but in the 3.2 and 2.7 news it is reported that “The multi-argument form of operator.attrgetter() function now runs slightly faster” while it should be “The multi-argument form of operator.attrgetter

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: The PyUnicode_GET_SIZE issue was still there, but I've fixed it and committed in r86036. Thanks for your contribution! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Py

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: The patch looks fine. You're overview of the process presented here in the tracker would make a nice comment in the code. If Antoine is happy with the latest patch, then it's ready to apply. -- assignee: rhettinger -> pitrou

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-30 Thread Christos Georgi ou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: Thank you very much, Antoine, for your review. My comments in reply: - the dead code: it's not dead, IIRC it ensures that at least one argument is given, otherwise it raises an exception. - PyUnicode_GET_SIZE: you're right. The previous

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: Some comments about the patch: - this seems to be some dead code: if (nattrs <= 1) { if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr)) return NULL; - you can't call PyUnicode_GET_SIZE or PyUnicode_AS_UNICODE before you have c

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-22 Thread Christos Georgi ou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: A newer version of the patch with the following changes: - single loop in the ag->attr setup phase of attrgetter_new; interning of the stored attribute names - added two more tests of invalid attrgetter parameters (".attr", "attr.") ---

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: >I am not sure whether I should attach a zip/tar file with both the attachments >(the sample benchmark and the diff); so I'll attach the diff in a further >comment. Uploading separate files with .py, .diff extensions that can be viewed in a browser is indeed

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-21 Thread Éric Araujo
Changes by Éric Araujo : -- components: -Documentation nosy: -d...@python ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Christos Georgi ou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: Modules/operator.c grows by ~70 lines, most of it the setup code for ag->attr; also I loop twice over the args of attrgetter_new, choosing fast code that runs once per attrgetter creation than temporary data. Alex's suggestion to make u

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Alex
Alex added the comment: Voice of ignorance here: why can't this be implemented in the "naive" way one might in Python, use the existing string splitting algorithms of stringlib, but just leave it in __new__. -- nosy: +alex ___ Python tracker

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for noticing this. I wasn't aware that it had slowed down after dotted name support had been added. Since it is a mild performance issue, I'm lowering the priority. Will take a further look when I get the chance. A first look at the patch shows t

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Christos Georgi ou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: An explanation to the changes. The old code kept the operator.itemgetter arguments in the ag->attr member. If the argument count (ag->nattrs) was 1, the single argument was kept; if more than 1, a tuple of the original arguments was kep

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Christos Georgi ou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: Newer version of the diff, since I forgot some "if(0) fprintf" debug calls that shouldn't be there. -- Added file: http://bugs.python.org/file19313/issue10160.diff ___ Python tracker

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Christos Georgi ou
Changes by Χρήστος Γεωργίου (Christos Georgiou) : Removed file: http://bugs.python.org/file19312/issue10160.diff ___ Python tracker ___ ___ Py

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- assignee: d...@python -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list ma

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Christos Georgi ou
Χρήστος Γεωργίου (Christos Georgiou) added the comment: Here comes the diff to Modules/operator.c, Doc/library/operator.rst and Lib/test/test_operator.py . As far as I could check, there are no leaks, but a more experienced eye in core development could not hurt. Also, obviously test_operato

[issue10160] operator.attrgetter slower than lambda after adding dotted names ability

2010-10-20 Thread Christos Georgi ou
New submission from Χρήστος Γεωργίου (Christos Georgiou) : (Discovered in that StackOverflow answer: http://stackoverflow.com/questions/3940518/3942509#3942509 ; check the comments too) operator.attrgetter in its simplest form (i.e. with a single non-dotted name) needs more time to execute t