mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-03 05:04:09 +03:00
Matcher
: Remove superfluous GIL-acquiring check in get_is_final
(#10659)
* `Matcher`: Remove superfluous GIL-acquiring check in `get_is_final` This check incurred a significant performance penalty due to implict interactions between the GIL and Cython ref-counting code. * `Matcher`: Inline `PatternStateC` accessors
This commit is contained in:
parent
229ecaf0ea
commit
aa6780eb27
|
@ -690,18 +690,14 @@ cdef int8_t get_is_match(PatternStateC state,
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
cdef int8_t get_is_final(PatternStateC state) nogil:
|
cdef inline int8_t get_is_final(PatternStateC state) nogil:
|
||||||
if state.pattern[1].quantifier == FINAL_ID:
|
if state.pattern[1].quantifier == FINAL_ID:
|
||||||
id_attr = state.pattern[1].attrs[0]
|
|
||||||
if id_attr.attr != ID:
|
|
||||||
with gil:
|
|
||||||
raise ValueError(Errors.E074.format(attr=ID, bad_attr=id_attr.attr))
|
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
cdef int8_t get_quantifier(PatternStateC state) nogil:
|
cdef inline int8_t get_quantifier(PatternStateC state) nogil:
|
||||||
return state.pattern.quantifier
|
return state.pattern.quantifier
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user