• Guido van Rossum's avatar
    Get a 3- to 4-fold speedup for sub()/subn(), split() and findall() by · ad1ad540
    Guido van Rossum authored
    not calling self.search(); instead, call self.code.match() directly
    and interpret the list of registers it returns directly.  This saves
    the overhead of instantiating a MatchObject for each hit, basically
    inlining search() as well as group().  When a MatchObject is still
    needed, one is allocated and reused for the duration of the scan.
    ad1ad540
re.py 11.3 KB