<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 25 April 2018 at 06:03, INADA Naoki <span dir="ltr"><<a href="mailto:songofacandy@gmail.com" target="_blank">songofacandy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Apr 25, 2018 at 12:04 PM, Nick Coghlan <<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>> wrote:<br>
> On 25 April 2018 at 04:56, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
>> On 04/24/2018 10:32 AM, Antoine Pitrou wrote:<br>
>><br>
>>> Also beware the import time cost of having a widely-used module like<br>
>>> "warnings" depend on the "enum" module and its own dependencies.<br>
>><br>
>><br>
>> With all the recent changes to Python, I should go through and see which<br>
>> dependencies are no longer needed.<br>
><br>
> I was checking this with "./python -X importtime -c 'import enum'",<br>
> and the overall import time was around 9 ms with a cold disk cache,<br>
> and 2 ms with a warm one. In both cases, importing "types" and<br>
> "_collections" accounted for around a 3rd of the time, with the bulk<br>
> of the execution time being enum's own module level code.<br>
><br>
<br>
</span>enum class&member creation cost is much heavier than "import enum" cost.<br>
Especially, "import socket, ssl" is much slower than before...<br><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Is it slow simply because we are creating new  class objects or EnumMeta.__new__ does</div><div>some extensive calculations? In the latter case rewriting EnumMeta in C might help.</div><div><br></div><div>--</div><div>Ivan</div><div><br></div></div><br></div></div>