[issue45417] Enum creation non-linear in the number of values

2021-10-15 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
stage: patch review -> backport needed
versions:  -Python 3.9

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-14 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset b2af211e229df941d9b404f69547a264115156b5 by Carl Friedrich 
Bolz-Tereick in branch 'main':
bpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)
https://github.com/python/cpython/commit/b2af211e229df941d9b404f69547a264115156b5


--

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-12 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

I fixed the reliance of set being insertion ordered in pypy and opened a pull 
request.

--

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-12 Thread Carl Friedrich Bolz-Tereick


Change by Carl Friedrich Bolz-Tereick :


--
nosy: +Carl.Friedrich.Bolz
nosy_count: 6.0 -> 7.0
pull_requests: +27198
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28907

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-10 Thread Ken Jin


Change by Ken Jin :


--
nosy: +barry, eli.bendersky, ethan.furman
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-10 Thread mattip


mattip  added the comment:

Over at PyPy arigo authored and we applied this fix to the as-yet unreleased 
pypy3.8. Note that it cannot be applied directly to CPython as sets are not 
ordered. Does the fix break anything? Tests in Lib/test/test_enum.py passed 
after applying it.

--
keywords: +patch
nosy: +mattip
Added file: https://bugs.python.org/file50341/quadratic-fix-2.diff

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-10 Thread Armin Rigo


Armin Rigo  added the comment:

The timing is clearly quadratic:

number of attributes time
1500 0.24s
3000 0.94s
6000 3.74s
1200015.57s

Pressing Ctrl-C in the middle of the execution of the largest examples points 
directly to the cause: when we consider the next attribute, we loop over all 
previous ones at enum.py:238.

--
nosy: +arigo

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-08 Thread Oliver Margetts


New submission from Oliver Margetts :

Creating large enums takes a significant amount of time. Moreover this appears 
to be nonlinear in the number of entries in the enum. Locally, importing a 
single python file and taking this to the extreme:

 1000 entries - 0.058s
1 entries - 4.327s

This is partially addressed by https://bugs.python.org/issue38659 and I can 
confirm that using `@_simple_enum` does not have this problem. But it seems 
like that API is only intended for internal use and the 'happy path' for 
user-defined enums is still not good.

Note that it is not simply parsing the file / creating the instances, it is to 
do with the cardinality. Creating 100 enums with 100 entries each is far faster 
than a single 1 entry enum.

--
files: huge.py
messages: 403512
nosy: olliemath
priority: normal
severity: normal
status: open
title: Enum creation non-linear in the number of values
type: performance
versions: Python 3.10, Python 3.11, Python 3.7
Added file: https://bugs.python.org/file50332/huge.py

___
Python tracker 

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