So I just tried it with the latest nightly build and `[:]` is now even
a bit faster than `list()`! Thank you once more!
On Tue, Sep 29, 2015 at 12:27 PM, Tuom Larsen wrote:
> Hi Armin,
>
> thanks a lot, both for the explanation and the fix! I will try it soon.
>
> Have a nice day!
>
> Tuom
>
> PS
Hi Armin,
thanks a lot, both for the explanation and the fix! I will try it soon.
Have a nice day!
Tuom
PS: The speed difference came from larger piece of code, which I tried
to reproduce in "minimal viable test case". Hence that `timeit`, where
it showed up as well. But in any case, thanks a l
Hi Tuom,
On Tue, Sep 29, 2015 at 7:31 AM, Tuom Larsen wrote:
> Please, let me rephrase my question: currently I use `[:]` because it
> is faster in CPython (0.131 usec vs 0.269 usec per loop). I almost
> don't mind changing it to `list()` because of PyPy but I was wondering
> what do PyPy develop
Hello Armin,
Thanks for the answer!
On Mon, Sep 28, 2015 at 8:17 PM, Armin Rigo wrote:
>
> In addition to the other comments, this is not testing what you think
> it is: 'range(100)' returns a list optimized for being a range, and
> 'list(range(100))' does it too. You can see it like this:
>
>>
Hi Tuom,
On Mon, Sep 28, 2015 at 3:57 PM, Tuom Larsen wrote:
> from timeit import timeit
> print timeit('b = a[:]', 'a = list(range(100))')# 0.0732719898224
> print timeit('b = list(a)', 'a = list(range(100))') # 0.00285792350769
In addition to the other comments, this is not tes
On Mon, 28 Sep 2015 at 14:57 Tuom Larsen wrote:
> Dear PyPy developers!
>
> In CPython, a common idiom to copy a list is to use slice, as in:
>
> copy = original[:]
>
> I noticed that under PyPy 2.6.0 it seems quite a bit slower than using
> `list` constructor:
>
> from timeit import time
Hello,
is your code actually such a heavy list-copy-through-slicing user ?
This question is independent from pypy's eventual desire to speed
this python "idiom", though.
I myself was using it, but went to use list(), as that look more natural,
to my eyes, but that's a matter of taste anyways, I
Dear PyPy developers!
In CPython, a common idiom to copy a list is to use slice, as in:
copy = original[:]
I noticed that under PyPy 2.6.0 it seems quite a bit slower than using
`list` constructor:
from timeit import timeit
print timeit('b = a[:]', 'a = list(range(100))')# 0.073