Subject: Re: sorting... From: Erik Naggum <email@example.com> Date: 1998/12/15 Newsgroups: comp.lang.lisp Message-ID: <firstname.lastname@example.org> * David Bakhash <email@example.com> | suppose that you have a list. You want to sort it. suppose that you | knew ahead of time that the list would be much closer to being sorted | if you reversed it. Would it make sense to call sort on the reversed | list rather than the list itself? would people think that this would | save time, or take more time? this is all wrong as an approach to improving performance. instead, study the available sort algorithms in the considerable literature and implement one that fits your data after you have discovered that the sorting time is significant to the rest of your work and worth fixing. I do (sort (cons <element> <sorted-list>) <test>) when adding one element at a time to a priority list. profiling shows that it is irrelevant to the execution time of the program, although I'd bet that some form of programmer instinct would be triggered by this particular example and would try to rewrite it. #:Erik -- man who cooks while hacking eats food that has died twice.