"Sebastien M." <ploouuf@xxxxxxxx> wrote: > > I have a strange behaviour when I compile my program with -O2: it becomes slower It isn't rare. The only way to find out for sure is to print the assembler, work out EXACTLY where everything is located and check it all carefully. You need to know a lot about computer architecture to do the analysis, too. Generally, it is due to a cache problem or similar. The alignment changes, and one of the codes has to reload a couple of locations each time round the loop. You can often make this phenomenon go away (or appear!) by adding a completely irrelevant statement elsewhere in the code. Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QH, England. Email: nmm1@xxxxxxxxx Tel.: +44 1223 334761 Fax: +44 1223 334679