RE: https://infosec.exchange/@nyanbinary/116595817222125451 Rewrite led to signi...

@nyanbinary@infosec.exchange

RE: infosec.exchange/@nyanbinary/1

Rewrite led to significant performance degradations - I decided to write a general filtered import function ( ✨ reusability :sparkles_blue: ) but this meant I lost the (accidental) performance increase from pythons lazy and. Doing the math now I got VERY lucky on the ordering of those checks in the first place (~ 30x speedup had I reversed the order, lol), but switch of data structures & this monster means its actually significantly faster now than before (& only eats ~20MB instead of 6GB).

def __lazyand__(functions):
if functions:
return lambda x: functions[0](x) and __lazyand__(functions[1:])(x)
else:
return lambda x: True