[issue14126] Speed up list comprehensions by preallocating the list where possible

2020-03-09 Thread STINNER Victor
STINNER Victor added the comment: > Isn't this the same as https://bugs.python.org/issue36551 ? Yes. -- ___ Python tracker ___

[issue14126] Speed up list comprehensions by preallocating the list where possible

2020-03-07 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Isn't this the same as https://bugs.python.org/issue36551 ? -- nosy: +pablogsal ___ Python tracker ___

[issue14126] Speed up list comprehensions by preallocating the list where possible

2020-03-07 Thread Ammar Askar
Ammar Askar added the comment: Aah, thanks for the catcher Victor. Missed that this was about list /comprehensions/, not the list constructor. -- ___ Python tracker ___

[issue14126] Speed up list comprehensions by preallocating the list where possible

2020-03-07 Thread STINNER Victor
STINNER Victor added the comment: > I believe this was implemented in issue33234 I don't think so. The bytecode in Python 3.9 still uses "BUILD_LIST 0": Python 3.9.0a4+ (heads/daemon_thread_runtime2-dirty:48652767d5, Mar 7 2020, 00:56:07) >>> def f(): ... for i in range(1): ...

[issue14126] Speed up list comprehensions by preallocating the list where possible

2020-03-06 Thread Ammar Askar
Ammar Askar added the comment: I believe this was implemented in issue33234 -- nosy: +ammar2 resolution: -> fixed stage: needs patch -> resolved status: open -> closed superseder: -> Improve list() pre-sizing for inputs with known lengths ___

[issue14126] Speed up list comprehensions by preallocating the list where possible

2020-03-06 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon status: pending -> open ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue14126] Speed up list comprehensions by preallocating the list where possible

2015-10-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> pending versions: +Python 3.6 -Python 3.3 ___ Python tracker ___

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-03-03 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: You should try to port the patch to 3.3 and do some benchmark there. Having some additional tests to make sure that it works fine in all the cases would be nice too (even if listcomps are already used elsewhere in the code/tests).

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-03-03 Thread Philip Jenvey
Philip Jenvey pjen...@underboss.org added the comment: iter(range(1)) should also see a speedup because range's iter supports __length_hint__ -- nosy: +pjenvey ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14126

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-03-03 Thread Mark Shannon
Mark Shannon m...@hotpy.org added the comment: Could you run the benchamrks at http://hg.python.org/benchmarks/ and report the results, for 3.3 (rather than 2.7), please? Adding a new bytecode because it speeds up one 4 line program does not seem such a good idea. -- nosy:

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-03-03 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14126 ___ ___ Python-bugs-list

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-03-02 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: I think this proposal should be rejected for three reasons. 1. I believe the idea is faulty in that it can only work if the single source iterable *has* a known length. The compiler cannot, in general, determine that and in practice seldom

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-03-02 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: This seems like a reasonable optimization to me. -- assignee: rhettinger - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14126

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-02-26 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14126 ___ ___ Python-bugs-list

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-02-25 Thread Alex Gaynor
New submission from Alex Gaynor alex.gay...@gmail.com: This adds a new opcode which for certain list comprehensions (ones with no if statements and only a single comprehension), preallocates the list to the appropriate size. Patch is against 2.7, because it was a bit easier. On: def f():

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-02-25 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14126 ___ ___ Python-bugs-list

[issue14126] Speed up list comprehensions by preallocating the list where possible

2012-02-25 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger priority: normal - low type: - performance ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14126 ___