A safer File.readln

Jens Mueller via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 25 11:12:52 PST 2017


On Wednesday, 25 January 2017 at 14:18:15 UTC, Andrei 
Alexandrescu wrote:
> On 01/25/2017 12:58 AM, TheGag96 wrote:
>> On Monday, 23 January 2017 at 13:18:57 UTC, Andrei 
>> Alexandrescu wrote:
>>> On 1/23/17 5:44 AM, Shachar Shemesh wrote:
>>>> If, instead of increasing its size by 100%, we increase it 
>>>> by a smaller
>>>> percentage of its previous size, we still maintain the 
>>>> amortized O(1)
>>>> cost (with a multiplier that might be a little higher, but 
>>>> see the trade
>>>> off). On the other hand, we can now reuse memory.
>>>
>>> Heh, I have a talk about it. The limit is the golden cut,
>>> 1.6180339887498948482... The proof is fun. Anything larger 
>>> prevents
>>> you from reusing previously used space. -- Andrei
>>
>> Andrei, could you link this talk? Thanks!
>
> Not public. -- Andrei

Have you done measurements on the matter? Because I'm not sold on 
the idea. To me at this point this is just a theoretical 
observation. There are also arguments indicating it is less 
useful. Any numbers on how it affects e.g. memory usage?

Jens


More information about the Digitalmars-d mailing list