Il giorno mar, 03/11/2015 alle 19.20 +0100, Manlio Perillo ha scritto:
> 2015-11-03 19:16 GMT+01:00 Manlio Perillo :
> > 2015-11-03 18:23 GMT+01:00 Manlio Perillo > >:
> > > 2015-11-03 18:19 GMT+01:00 Manlio Perillo > > om>:
> > > [...]
> > > > Tieni conto che con Python è ben possibile che ci si
2015-11-03 19:16 GMT+01:00 Manlio Perillo :
> 2015-11-03 18:23 GMT+01:00 Manlio Perillo :
>> 2015-11-03 18:19 GMT+01:00 Manlio Perillo :
>> [...]
>>> Tieni conto che con Python è ben possibile che ci siano altri fattori
>>> che "mascherano" le performance reali [1].
>>> Magari l'indexing di un arra
2015-11-03 18:23 GMT+01:00 Manlio Perillo :
> 2015-11-03 18:19 GMT+01:00 Manlio Perillo :
> [...]
>> Tieni conto che con Python è ben possibile che ci siano altri fattori
>> che "mascherano" le performance reali [1].
>> Magari l'indexing di un array numpy non accede direttamente alla
>> memoria com
2015-11-03 18:19 GMT+01:00 Manlio Perillo :
> 2015-11-03 17:19 GMT+01:00 Pietro Battiston :
>> Salve a tutti di nuovo,
>>
>> se definisco un semplice Fibonacci con una cache (volutamente un po'
>> stupida):
>>
>
>> [...]
>> E va bene che il
>> dizionario Python è una struttura efficiente, ma... è s
2015-11-03 17:19 GMT+01:00 Pietro Battiston :
> Salve a tutti di nuovo,
>
> se definisco un semplice Fibonacci con una cache (volutamente un po'
> stupida):
>
> [...]
> E va bene che il
> dizionario Python è una struttura efficiente, ma... è sempre una hash
> table più un indexing, come fa a batte
Salve a tutti di nuovo,
se definisco un semplice Fibonacci con una cache (volutamente un po'
stupida):
def _fib(n, cache):
cached = cache[n]
if cached != -1:
return cached
res = _fib(n-1, cache) + _fib(n-2, cache)
cache[n] = res
return res
def dfib(n):
cache = {i: