[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Dong-hee Na


Change by Dong-hee Na :


--
resolution:  -> wont fix
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



[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

> I would rather not do this.

I would not like to say this change should be applied ;)
I found this point during I converting deque methods by using 
Argument Clinic(I will ping you later ;)


https://bugs.python.org/issue39425 was applied since PyObject_RichCompareBool 
requires reference counting and it caused performance regression. 

Know I remember, why we applied this micro-optimization.

So my conclusion is that don't apply this change.
We don't have to apply this change since PyObject_RichCompareBool does not 
cause a performance regression.

Thank you for your comment, Raymond.

--

___
Python tracker 

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



[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I would rather not do this.   It optimizes for the uncommon case where all the 
objects are identical.  The common case is slightly worse off because the 
identity test is performed twice, once before the call to Py_RichCompareBool() 
and again inside it.  Also, the PR adds a little clutter which obscures the 
business logic.  

Another thought, micro-benchmarks on the identity tests require some extra care 
because they are super sensitive to branch prediction failures (See 
https://stackoverflow.com/questions/11227809 ).  A more realistic dataset would 
be:

  x = 12345
  data = [x] * 100 + list(range(500))
  random.shuffle(data)
  data.count(x)

--

___
Python tracker 

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



[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Dong-hee Na


New submission from Dong-hee Na :

Same situation as: https://bugs.python.org/issue39425

Mean +- std dev: [master_count] 946 ns +- 14 ns -> [ac_count] 427 ns +- 7 ns: 
2.22x faster (-55%)

--
assignee: corona10
components: Extension Modules
messages: 374010
nosy: corona10
priority: normal
severity: normal
status: open
title: collections.deque.count performance enhancement
type: performance
versions: Python 3.10

___
Python tracker 

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



[issue41347] collections.deque.count performance enhancement

2020-07-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

Benchmark file

--
Added file: https://bugs.python.org/file49328/bench_deque_count.py

___
Python tracker 

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