Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

> I do not see any significant change in + operator timing on my machine 
> (again, just a rough test):

Because the time includes the time of iterating, which can be significant in 
comparison with adding two integers. Please use the pyperf module with 
--duplicate=1000.

> I'm aware that unpacking is "better". With that said, adding a list literal 
> (or a slice of any list, or a list comprehension) to another list is a fairly 
> common operation (I count several dozen examples in the stdlib).

Could you provide any numbers? For example you can patch ceval.c to count these 
BINARY_ADD for which your optimization works and these for which it does not 
work and output counts at the exit of Python. Run several Python programs with 
the modified interpreter. Tests are bad example, but better than nothing. 
Something like hg would be better. You are free to find programs that would 
benefit the most from your optimization.

> And the speed-up is good, even in these cases.

5%. It is not impressive for optimizing a single rare operation.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38436>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to