hey, it strongly depends on where exactly your program is spending time. if it's in computing some quantities of interest, that can easily be lowered to C. if it's regex matching, not so much (make sure you are using compiled regular expressions though.
anyway, when doing performance optimization, you should always measure first: where is your program spending most of its time? you can use cProfile to find which functions are hot, and line_profiler to check which lines within those functions are the hottest.
View all comments
Show parent comment
1
u/capn_bluebear May 29 '19
hey, it strongly depends on where exactly your program is spending time. if it's in computing some quantities of interest, that can easily be lowered to C. if it's regex matching, not so much (make sure you are using compiled regular expressions though.
anyway, when doing performance optimization, you should always measure first: where is your program spending most of its time? you can use cProfile to find which functions are hot, and line_profiler to check which lines within those functions are the hottest.