On Fri, 11 Jan 2002, Richard Fateman wrote:
> If you want to make programs fast, a really good idea
> is to ignore your intuition and profile them first. That is,
> take some representative problems and run them through
> you program, and use tools to see where the time is taken.
> Typically 90% of the time is taken in 10% of the code.
> Then consider if you want to rewrite that 10%. Any
> time spent on the rest of the code is basically wasted, since
> you cannot improve the running time by more than 10%.
I totally agree.
> So it may be appealing to think that position_if should
> be replaced, it is not obvious to me that reprogramming
> it is the key.
>
>
> It may be plausible to use arrays or vectors or some other
> data structure rather than lists, if the lists become really
> long and you are constantly pasting things on the end. Another
> approach that sometimes helps is to build lists backwards,
> since (cons x longlist) is cheap, but (nconc longlist (list x))
> takes time proportional to length of longlist. It may also be
> worthwhile to store the length of a list along with it, rather
> than computing its length each time.
>
> It is possible to reverse a list in place rapidly after everything
> else is done.
OK, this is very true in this algorithm. I will change it.
> But profiling is the first priority.
> (Actually the very very first priority is getting the program
> to provide the right answers. And also to decide if the program
> is already fast enough.
> )
ditto
> If you have some long-running burge.lisp inputs, I would
> be willing to profile the problem.
> RJF
actually, I implemented the algorithm only to see wether it is much slower
than MMA. (In this case I had a problem using maxima) In fact, it is much
faster then MMA, so I like maxima even better. I hope it's OK for you if I
get back to your offer when I need it?
> PS, I tend to think that lisp is more readable, too. Obviously
> this would not be the case for people totally unfamiliar
> with lisp!
I agree. But I tend to think that maxima people really should become
familiar with maxima and lisp, if they are not only USING algorithms
implemented by other people. Actually, this is the essence of my idea. I
think it would be a shame if I can't write stuff in lisp just because the
maxima community doesn't understand it. Of course, I only want to write in
lisp if it suits my problem and I suspect that this is sometimes the case
but not always. The burge and RSK correspondences and much things about
Tableaux are in fact statements on lists. So I want to use lists.
Martin