[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Dong-hee Na


Change by Dong-hee Na :


--
resolution:  -> rejected
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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Dong-hee Na


Dong-hee Na  added the comment:

Just for the record,

https://github.com/python/cpython/pull/19677#discussion_r413894982

guido left an opinion that the caching approach might be more proper.
So I 'd like to suggest open a new issue for caching. :)

--

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Dong-hee Na


Dong-hee Na  added the comment:

> And how much faster has your example become?

For function declaration, 5% enhancement,
the function call does not show difference because the GenericAlias is not big 
portion on calling.

++++
| Benchmark  | master-generic-alias-1 | bpo-40369-generic-alias-1  |
++++
| bench GenericAlias | 420 ns | 399 ns: 1.05x faster (-5%) |
++++

--

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And how much faster has your example become?

--

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Dong-hee Na

Dong-hee Na  added the comment:

> Do you have any realistic example which would benefit from speeding up the 
> creation of GenericAlias instances?

Hmm I did not find loop tightly calling case, but
for example, this kinds of usage are very often.

def create_q(l: list[int]) -> Queue[int]:
q = Queue[int]()
for e in l:
q.put(e)
return q

a = create_q([1,2,3,4,5])

In this code, GenericAlias is called 2 times for function declare and function 
call.

It's true that GenericAlias ​​has a small portion in this scenario,
but wouldn't it be worth it if we could optimize itself to a few lines of code?

--

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I have doubts that GenericAlias instances are created in mass in tight loops. 
Do you have any realistic example which would benefit from speeding up creation 
of GenericAlias instances?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread Dong-hee Na


Dong-hee Na  added the comment:

> Can you propose a PR, so I can have a look at the implementation?

Got it :), I will upload it soon.

--

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

> if the suggestion is accepted, I 'd like to summit the patch :)

Can you propose a PR, so I can have a look at the implementation?

--

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
assignee:  -> corona10
type:  -> performance

___
Python tracker 

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



[issue40369] Use PEP 590 vectorcall to speed up GenericAlias.

2020-04-22 Thread Dong-hee Na


New submission from Dong-hee Na :

Since PEP 560 was approved,
The following syntax has become available. 

from queue import Queue
v = Queue[int]

It's a very shiny feature.
Given the direction of programming language, it's probably a very useful 
feature that users will use very often in the near future.

When I looked at Object/geneticiasobject.c, the current implementation is a 
very good condition for using the vectorcall proposed by PEP590 .

The benchmarks are as follows.
So I suggest using vectorcall in GenericAlias.

if the suggestion is accepted, I 'd like to summit the patch :)


++--+-+
| Benchmark  | master-generic-alias | proposed-generic-alias  |
++==+=+
| bench GenericAlias | 143 ns   | 111 ns: 1.29x faster (-22%) |
++--+-+

--
components: Interpreter Core
files: bench_generic_alias.py
messages: 367074
nosy: corona10, gvanrossum, vstinner
priority: normal
severity: normal
status: open
title: Use PEP 590 vectorcall to speed up GenericAlias.
versions: Python 3.9
Added file: https://bugs.python.org/file49087/bench_generic_alias.py

___
Python tracker 

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