import sys #https://stackoverflow.com/questions/65271060/is-there-a-built-in-way-to-use-inline-c-code-in-python # cffi? https://stackoverflow.com/questions/65271060/is-there-a-built-in-way-to-use-inline-c-code-in-python # python benchmarks # ch-2: perl using List::BinarySearch and Judy1 def make_regex_search(r): def regex_search(binary_list): match = r.search(''.join(['1' if value==1 else '0' for value in binary_list])) result = 0 if not match else len(match.group(1)) return result return regex_search import re naive_regex = make_regex_search(re.compile('(1+)(?!.*?\\1)')) better_regex = make_regex_search(re.compile('(?