2 ms·
import gc gc.disable() in python. The python script would previously take 4 hours to run. There were lots of small functions and these were called on a loop. I
by sharmi 6y ago
import gc
gc.disable()
in python. The python script would previously take 4 hours to run. There were lots of small functions and these were called on a loop. I ensured that there were no circular references within any of the functions and then disabled gc (Which is what the gc would look for, variables without circular references would be garbage collected automatically when they go out of scope.)
The script ran in 20 mins.
The hue and cry people raised over the gc.disable though convinced me never to do any unconventional optimizations again.