Re: random numbers
- Posted by CChris <christian.cuvier at ag?i?ulture.gouv.fr> Nov 22, 2007
- 557 views
Derek Parnell wrote: > > CChris wrote: > > > > Derek Parnell wrote: > >> ... if only there was a built-in swap operation for even faster run times. > >> swap s[r] with s[i] !!! > > > > > Swap operation: I am not sure swap(sequence s,integer index1,integer index2) > > would be much faster than current > > }}} <eucode> > > temp=s[index1] > > implicit_temp=s[index2] > > s[index1]=implicit_temp > > s[index2]=temp > > </eucode> {{{ > > because of the overhead of routine calls. > > I said swap OPERATION and not swap FUNCTION. The idea being that there would > be an in-built operation, like the arithmetic operations, that performs > optimal > swap functionality so we wouldn't have a function call overhead. > > -- > Derek Parnell > Melbourne, Australia > Skype name: derek.j.parnell Ok, this will avoid the overhead of the call. Yet I wonder how much speed you can gain this way wrt current sequene of assignments. At least you'll gain clearer code - not a small benefit. CChris