Making byLine faster: we should be able to delegate this

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 22 10:16:08 PDT 2015


On 3/22/15 10:13 AM, tcak wrote:
> 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?

D's statics are thread-local. -- Andrei



More information about the Digitalmars-d mailing list