Re: Best solution definition
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg634] Re: [mg613] Best solution definition
- From: wmm at chem.wayne.edu (Martin McClain)
- Date: Fri, 31 Mar 95 11:11:14 EST
Most of what I write is for students, so my vote goes to READABILITY and CLARITY, unless: 1. The non-obvious answer is so neat it can't be resisted. (*But then it should include in-line comments to help the reader over the non-obvious spots.*) And it should never include those comic strip expletives ##.@!%\&@#1#2<>><!&!! so admired in Champaign (except the postfixes // and /. , which help readability). In particular, PURE FUNCTIONS should NEVER be exposed in public. 2. The timing is so bad that a human notices it on one execution. 3. It is an item destined for multiple reuse, where timing is a legitimate issue. But even here, two versions should be given: one readable, the other coded to shave off the microseconds. > This is just a question that I have been wondering about. Frequently >when a problem is posed on this group, the way the "best" solution is >defined is by timing alone. I have always thought one of the appeals about >MMA is how naturally a solution flows from the typical pencil and paper >approach. Frequently this doesn't lead to the fastest solution but >definitely the easiest to read. When the solution takes advantage of a >more cryptic technique, the readability suffers. How does everyone feel >about using timing as the primary yard stick? How often do you run into >calculations where timing becomes a problem? > > Just for my curiosity, > Daryl