Re: [Python-ideas] No need to add a regex pattern literal

2019-01-01 Thread Stefan Behnel
Ma Lin schrieb am 31.12.18 um 14:02: > On 18-12-31 19:47, Antoine Pitrou wrote: >> The complaint is that the global cache is still too costly. >> See measurements in https://bugs.python.org/issue35559 > > In this issue, using a global variable `_has_non_base16_digits` [1] will > accelerate 30%. >

Re: [Python-ideas] No need to add a regex pattern literal

2019-01-01 Thread Ma Lin
On 19-1-1 21:39, Stefan Behnel wrote: > I wouldn't be surprised if the slowest part here was the isinstance() > check. Maybe the RegexFlag class could implement "__hash__()" as "return > hash(self.value)" ? Apply this patch:  def _compile(pattern, flags): # internal: compile pattern -    if