Write this accumuator in a functional style
Rhodri James
rhodri at kynesim.co.uk
Thu Jul 13 11:59:41 EDT 2017
On 13/07/17 16:09, Rustom Mody wrote:
> Pavol Lisy wrote:
>> IMHO problem is doubling size for huge lists.
>
>> Or waste big memory for huge frozensets. I mean resize it to 2*N if
>> its size is just N+1.
>
> Couple that with the fact that space-time are not unrelated on any modern VM based OS + cache based hw. Doubly so for "managed" languages where gc buys space for time.
>
You might want to do some benchmarks to sound out that idea. I believe
conventional wisdom is that the time cost of allocating more memory and
extending the list outweighs the space cost of wasted memory.
--
Rhodri James *-* Kynesim Ltd
More information about the Python-list
mailing list