[GAP Forum] performance of GAP
Laurent Bartholdi
laurent.bartholdi at epfl.ch
Sun Feb 27 13:57:12 GMT 2005
hi there,
prompted by a question on this forum [how does GAP perform compared to C
code], i did the following experiment:
gap> L := List([1..10^7],SignInt);; time;
4890
gap> L := List([1..10^7],i->SignInt(i));; time;
7330
gap> L := [];; for i in [1..10^7] do Add(L,SignInt(i)); od; time;
5480
I would naively have expected all 3 timings to be the same. is there a
general rule of "fastest coding style": avoid creating function objects,
but use the primitive "List()" as often as possible?
be happy,
laurent
--
--
Laurent Bartholdi \ laurent.bartholdi<at>epfl<dot>ch
EPFL, IGAT, Bâtiment BCH \ Téléphone: +41 21-6930380
CH-1015 Lausanne, Switzerland \ Fax: +41 21-6930385
More information about the Forum
mailing list