On Sat, 22 Jan 2011, Sven Schreiber wrote:
Am 22.01.2011 20:59, schrieb Allin Cottrell:
> 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.
>
Hm, thanks but this actually makes things worse...
Sorry, should have said: you need up-to-the-minute CVS for that to
be faster. I just removed a debugging printout to stderr that
appeared in connection with "eval" and that would really slow
things down on a million-repetition loop.
As for documenting eval, point taken.
Allin