Re:Python, Catastrophic Regular Expressions and the GIL (2013)
by asah on Monday November 14, 2022 @09:29AM
(#33594387)
assuming it's legal to do so, GIL release seems like a reasonable flag to add to possibly-expensive functions like re.()
... or even better, have re. track its own performance and release the GIL if it forecasts that it statistically-might use a lot more computation... a trivial strawman algorithm: if len(input) > MAX then release GIL first.
... or even better, have re. track its own performance and release the GIL if it forecasts that it statistically-might use a lot more computation... a trivial strawman algorithm: if len(input) > MAX then release GIL first.