I have relatively many patterns that i try to search in a text. I discovered that compiling the patterns takes quite some time. Therefore I have pre-compiled them when starting the program. However this takes quite some memory. I've compared it with the memory used by re module and it is at least triple. Does anybody have some experience with this? Any better suggestions?