Making byLine faster: we should be able to delegate this

tcak via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 22 10:13:20 PDT 2015


On Sunday, 22 March 2015 at 16:03:11 UTC, Andrei Alexandrescu 
wrote:
> On 3/22/15 3:10 AM, Vladimir Panteleev wrote:
>> On Sunday, 22 March 2015 at 07:03:14 UTC, Andrei Alexandrescu 
>> wrote:
>>> * For each line read there was a call to malloc() and one to 
>>> free(). I
>>> set things up that the buffer used for reading is reused by 
>>> simply
>>> making the buffer static.
>>
>> What about e.g.
>>
>> zip(File("a.txt").byLine, File("b.txt").byLine)
>
> No matter, the static buffer is copied into the result. -- 
> Andrei

I didn't see the code though, won't using "static" buffer make 
the function thread UNSAFE?

I think we should add somewhere in documentation about thread 
safety as well. Phobos doesn't have any.


More information about the Digitalmars-d mailing list