Would Shlemiel the Painter Optimize Prematurely?

I don’t want to optimize this code prematurely. And “while you’re still writing it” is probably premature. On the other hand, totally ignoring algorithmic complexity is a sure route to a Shlemiel the Painter’s algorithm.

Do I really want to just write the whole thing, and then start profiling it to see where the hot spots are, and then possibly have to re-design the whole thing? That seems like the complete opposite of “work smarter, not harder”. Then again, it doesn’t matter if you write an O(n2) or even O(n!) algorithm if n is always going to be small… and in this application, I expect low-to-middling n values.

Of course, even if n will always be small, and increasing CPU power is my friend… even if it performs fast enough to make users happy, I’ll still know there’s a problem down there in the details. That may be the deciding factor.

One Comment

  1. Fatal error: Uncaught Error: Call to undefined function ereg() in /websites/mactane/live/blog/wp-content/themes/coyote/functions.php:300 Stack trace: #0 /websites/mactane/live/blog/wp-content/themes/coyote/comments.php(35): sandbox_commenter_link() #1 /websites/mactane/live/blog/wp-includes/comment-template.php(1556): require('/websites/macta...') #2 /websites/mactane/live/blog/wp-content/themes/coyote/single.php(52): comments_template() #3 /websites/mactane/live/blog/wp-includes/template-loader.php(106): include('/websites/macta...') #4 /websites/mactane/live/blog/wp-blog-header.php(19): require_once('/websites/macta...') #5 /websites/mactane/live/blog/index.php(17): require('/websites/macta...') #6 {main} thrown in /websites/mactane/live/blog/wp-content/themes/coyote/functions.php on line 300