Batuhan Taskaya <isidenti...@gmail.com> added the comment:

I've given this another shot, but even though I was able to create a patch that 
preserved slices as (type(slice), start, stop, step) tuples in the 
consts_cache, this final optimization prevented me to finalize it; 
😃https://github.com/python/cpython/blob/master/Python/compile.c#L5855-L5858

So, unless anyone else came up with a reasonable idea to do this optimization 
at the compile-time without actually making them hashable, I am re-proposing 
the idea of making them hashable.

Pro:
  - Up to %30+ speedup on slicing with constants (extremely common)
Cons:
  - Mappings accepts slices, which would rarely lead some esoteric cases (like 
the examples given)

Comments would be appreciated

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42454>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to