There are a lot of syntax highlighting editors/IDEs out there. What if we were to create an editor/IDE that would analyze the source code, and highlight stuff based on estimated best/average/worst case runtimes.
For example, something like:
print 'hi'
would be black, but
def bubblesort(inputList): ...
would be red, with other stuff being in between. The editor would use a database of known built-in functions (specific to the language) and idioms with some other heuristics thrown in.
[As a bonus, the editor could offer complexity-based refactoring hints]-- cowtamer, Mar 23 2007 Alan Turing's Halting Problem http://en.wikipedia...iki/Halting_problemGood luck. [zen_tom, Mar 23 2007] Busy Beaver Functions http://en.wikipedia.org/wiki/Busy_beaverNot sure how you'd be able to spot these type of things. [zen_tom, Mar 23 2007] It should have several modes so you can see a summary plus highlighted code for several criteria. That way, you can write your code, enter "runtime mode", and see at a glance your bottle necks. Next, enter "maintainability mode", so on so forth.
This would discourage premature optimisation, as you could concentrate on getting the thing to work first and know you'll have a guide for optimisation later when you've forgotten how everything fits together.-- TheLightsAreOnBut, Mar 23 2007 It would also depend on the architecture of the target machine - I've worked on machines where FFTs were trivial, but string searches nigh-on impossible.-- AbsintheWithoutLeave, Mar 23 2007 This is meant to be more of a complement to a syntax or maintainability highlighting editor, which is fully baked (Eclipse, WingIDE, etc.).
To add context: We recently found a bubble-sort routine implemented in somewhat convoluted python embedded in our (not well documented) code. Something like this would have at least given the author an idea that they were doing something slow and unnecessary (python has built-in sorting). Clearly it won't catch everything, and won't be right about everything-- cowtamer, Mar 27 2007 random, halfbakery