On Jan 22, 5:34 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 22, 12:15 am, Paddy <[EMAIL PROTECTED]> wrote: > > > On Jan 22, 3:20 am, Alan Isaac <[EMAIL PROTECTED]> wrote:> I want to > > generate sequential pairs from a list. > > <<snip>> > > > What is the fastest way? (Ignore the import time.) > > > 1) How fast is the method you have? > > 2) How much faster does it need to be for your application? > > 3) Are their any other bottlenecks in your application? > > 4) Is this the routine whose smallest % speed-up would give the > > largest overall speed up of your application? > > I believe the "what is the fastest way" question for such small well- > defined tasks is worth asking on its own, regardless of whether it > makes a difference in the application (or even if there is no > application to begin with).
Hi George, You need to 'get it right' first. Micro optimizations for speed without thought of the wider context is a bad habit to form and a time waster. If the routine is all that needs to be delivered and it does not perform at an acceptable speed then find out what is acceptable and optimise towards that goal. My questions were set to get posters to think more about the need for speed optimizations and where they should be applied, (if at all). A bit of forethought might justify leaving the routine alone, or optimising for readability instead. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list