Aug. 5th, 2008

Ignore unless you're a CS nerd :)

A friend of mine has a program that computes a funky number theoretical function. Unfortunately, it was taking 5 days to run. I volunteered to take a look at it, and managed to reduce the runtime to about 5 minutes by adding 14 characters to the code. Huzzah for optimization! As part of my investigations, I got yet another reminder that trying to guess where the slow bits are is pretty much useless. The actual culpit turned out to be that the math package she was using decided for some reason to use really really slow symbolic computations of floor() and ceil() instead of just using the built in versions. A couple of casts, and voila--a couple of orders of magnitude of improvement. But I would never have suspected that just by staring at the code.

Profile

vshnayder

September 2009

S M T W T F S
   12345
6789101112
13141516171819
20212223 242526
27282930   

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 21st, 2017 06:54 am
Powered by Dreamwidth Studios