[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python list micro-benchmarks
From: |
Collin Funk |
Subject: |
Re: Python list micro-benchmarks |
Date: |
Sun, 7 Apr 2024 18:01:31 -0700 |
User-agent: |
Mozilla Thunderbird |
Hi Paul,
On 4/7/24 5:51 PM, Paul Eggert wrote:
> a.append should be faster, as it need not cons the singleton.
Thanks. Yes, that it is what I was trying to get at. But I didn't know
the correct wording. :)
Here is 'var.extend(["a"])' added to the simple timeit comparison:
>>> import timeit
>>> timeit.timeit(stmt='var += ["a"]', setup='var = []', number=100000000)
6.978962032000709
>>> timeit.timeit(stmt='var.extend(["a"])', setup='var = []', number=100000000)
6.58610403899911
>>> timeit.timeit(stmt='var.append("a")', setup='var = []', number=100000000)
1.8816217469993717
Collin
- Re: gnulib-tool.py: Use 'Any' instead of type unions in GLConfig., (continued)
- Re: gnulib-tool.py: Fix 'consider-using-with' pylint warnings., Bruno Haible, 2024/04/05
- Re: gnulib-tool.py: Fix 'consider-using-with' pylint warnings., Collin Funk, 2024/04/05
- Re: gnulib-tool.py: lists vs. sets, Bruno Haible, 2024/04/06
- Re: gnulib-tool.py: lists vs. sets, Collin Funk, 2024/04/06
- Re: gnulib-tool.py: lists vs. sets, Bruno Haible, 2024/04/07
- Re: gnulib-tool.py: lists vs. sets, Collin Funk, 2024/04/07
- Re: Python list micro-benchmarks, Bruno Haible, 2024/04/07
- Re: Python list micro-benchmarks, Collin Funk, 2024/04/07
- Re: Python list micro-benchmarks, Paul Eggert, 2024/04/07
- Re: Python list micro-benchmarks,
Collin Funk <=
- Re: Python list micro-benchmarks, Bruno Haible, 2024/04/08
- Re: Python list micro-benchmarks, Collin Funk, 2024/04/08
- Re: Python list micro-benchmarks, Bruno Haible, 2024/04/08
- Re: Python list micro-benchmarks, Paul Eggert, 2024/04/08
- Re: Python list micro-benchmarks, Collin Funk, 2024/04/08
- gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'., Collin Funk, 2024/04/08
- Re: gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'., Bruno Haible, 2024/04/08
- Re: gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'., Collin Funk, 2024/04/08