On 01/22/2011 01:27 PM, Riccardo (Jack) Lucchetti wrote:
On Sat, 22 Jan 2011, Riccardo (Jack) Lucchetti wrote:
> On Sat, 22 Jan 2011, Sven Schreiber wrote:
>
>> The funny thing is that the first version of the code that copies
>> the
>> generated number to the variable 'temp' is about 50% slower than the
>> version without such copying!
>
> Confirmed here. I'll look into this.
From some preliminary analysis, the difference seems to come from
the fact that assigning the result to a variable avoids calling
is_gretl_function_call() at line 2369 of lib/src/interact.c; this,
in turn, saves calls to sscanf(), which is quite expensive. Mumble
mumble.
If you replace
muniform(1,1)
with
eval muniform(1,1)
then it runs faster than the version with copying. The sooner
gretl can figure out what you want, the faster.
Allin