the need for speed Funny, how when confronted with something that is much faster than something you thought was "good enough," the "good enough" feeling starts to fade. The fact that the Java Applet version of the generation code kicks the Python version ass so soundly is due to several reasons, many of which I am probably unaware of. But the ones that I suspect contribute the most are: The Java version does a lot of bit twiddling to radically optimize the processing (at the expense of imposing an uppr bound on the coordinates that is much less than the full range on an integer (even on a 16-bit platform)); JVM's, in general, have had much more optimization done to them than the Python interpreter; For readability and convenience, I have artificially slowed down the algorihm by using tuples and dictionaries. So, while it is a fast Python algorithm, it is a relatively slow implementation of the general algorithm. And now I want to code it in C to make it even faster than the Java version. I want victory. It's like that point in an auction when it is no longer about getting something at a really good price, and becomes about beating the other guy at all costs.
Heck, if this keeps up, I'll end up implementing
Hensel's algorithm. And it will probably do something unspeakable
to my soul. |