[issue39425] list.count performance regression

2021-12-10 Thread Maxwell Bernstein


Change by Maxwell Bernstein :


--
nosy: +tekknolagi
nosy_count: 5.0 -> 6.0
pull_requests: +28262
pull_request: https://github.com/python/cpython/pull/30036

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17516
pull_request: https://github.com/python/cpython/pull/18130

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> The following result is a little bit surprising:

haha, I went to exactly the same journey when reviewing this PR :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

> In fact, PyObject_RichCompareBool() has a fast path if the two object 
> pointers are equal

It's documented:

https://docs.python.org/dev/c-api/object.html?highlight=pyobject_richcomparebool#c.PyObject_RichCompareBool

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

The following result is a little bit surprising:

>>> nan=float("nan"); ([nan]*5).count(nan)
5
>>> nan == nan
False

But in fact, the optimization doesn't change the value. It was already 5 
previously.

In fact, PyObject_RichCompareBool() has a fast path if the two object pointers 
are equal:

/* Quick result when objects are the same.
   Guarantees that identity implies equality. */
if (v == w) {
if (op == Py_EQ)
return 1;
else if (op == Py_NE)
return 0;
}

In short, the optimization is good: thank you ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 9e06d61af30bac4fcacb7973f826147ccc010392 by Pablo Galindo (Miss 
Islington (bot)) in branch '3.7':
bpo-39425: Fix list.count performance regression (GH-18119) (GH-18121)
https://github.com/python/cpython/commit/9e06d61af30bac4fcacb7973f826147ccc010392


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks for the PR, Dong-hee Na :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset fdb21609d944941f0732df72dc3d07a7a9a7efea by Pablo Galindo (Miss 
Islington (bot)) in branch '3.8':
bpo-39425: Fix list.count performance regression (GH-18119) (GH-18120)
https://github.com/python/cpython/commit/fdb21609d944941f0732df72dc3d07a7a9a7efea


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17507
pull_request: https://github.com/python/cpython/pull/18120

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread miss-islington


miss-islington  added the comment:


New changeset 14d80d0b605d8b148e14458e4c1853a940071462 by Miss Islington (bot) 
(Dong-hee Na) in branch 'master':
bpo-39425: Fix list.count performance regression (GH-18119)
https://github.com/python/cpython/commit/14d80d0b605d8b148e14458e4c1853a940071462


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17508
pull_request: https://github.com/python/cpython/pull/18121

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +inada.naoki, pablogsal, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
pull_requests: +17506
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18119

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


New submission from Dong-hee Na :

./python.exe -m pyperf timeit -s 'a = [1]*100'  'a.count(1)'

Current Master: Mean +- std dev: 1.05 us +- 0.03 us
My patch: Mean +- std dev: 423 ns +- 11 ns

This is the side-effect of pr 17022.

--
assignee: corona10
messages: 360488
nosy: corona10
priority: normal
severity: normal
status: open
title: list.count performance regression
type: performance
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com