Live data from Hacker News

Ask HN: Largest speedup you ever achieved by only changing a few lines of code?

news.ycombinator.com

21–26 of 26 posts

Re: Ask HN: Largest speedup you ever achieved by only changing a few lines of code?

#21
Not really lines of code as such, but in Visual Foxpro, opening a DBF (database table file) on a fileserver, from an application running on that fileserver, referring to the file using its local path rather than a mapped network drive file path, resulted in a big speedup. (the application typically runs on RDP servers, but can also be run directly on the fileserver, which we do for some heavy-duty processes)

Re: Ask HN: Largest speedup you ever achieved by only changing a few lines of code?

#22
Sending campaign flow would create tens of thousands records on DB. After each record insertion, there was a sleep(0.1) - in place to solve problems related to master/slave setup in other flows - just conditionally disabling the sleep was enough to reduce the procedure time from ~5min to ~30 secs

Re: Ask HN: Largest speedup you ever achieved by only changing a few lines of code?

#23
post #21

Not really lines of code as such, but in Visual Foxpro, opening a DBF (database table file) on a fileserver, from an application running on that fileserver, referring to the file using its local path rather than a mapped network drive file path, resulted in a big speedup. (the application typically runs on RDP servers, but can also be run directly on the fileserver, which we do for some heavy-duty processes)

Mine is in a similar time frame. We had a TV guide where the "box grid" layout was done in WordPerfect 5. Huge ugly set of macros and QB scripts to take ASCII data downloads and munge it all up. Generally took 3 days to run on the fattest 286 in the house.

I changed it to generate single page files instead of one large document (we did 14 days of schedule at a time) and it was finishing in less than 6hr.

Lost that job for that one, the boss had coded the system.

Re: Ask HN: Largest speedup you ever achieved by only changing a few lines of code?

#25
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.

Post reply on HN