Re: Avoid gratuitous closure allocations

2019-09-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 20, 2019 5:21:22 AM MDT Ali Çehreli via Digitalmars-d- learn wrote: > tl;dr Instead of returning an object that uses local state, return an > object that uses member variables. The other issue this helps with is problems related to having multiple contexts. IIRC, without it,

Re: Avoid gratuitous closure allocations

2019-09-20 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Sep 20, 2019 at 01:03:29PM +, Andrea Fontana via Digitalmars-d-learn wrote: > On Friday, 20 September 2019 at 11:21:22 UTC, Ali Çehreli wrote: > > tl;dr Instead of returning an object that uses local state, return > > an object that uses member variables. > > Really good to know

Re: Avoid gratuitous closure allocations

2019-09-20 Thread Andrea Fontana via Digitalmars-d-learn
On Friday, 20 September 2019 at 11:21:22 UTC, Ali Çehreli wrote: tl;dr Instead of returning an object that uses local state, return an object that uses member variables. Really good to know tips!

Avoid gratuitous closure allocations

2019-09-20 Thread Ali Çehreli via Digitalmars-d-learn
tl;dr Instead of returning an object that uses local state, return an object that uses member variables. We've discovered one such allocation inside std.format.sformat today during our local meetup[1], started fixing it, and discovered that it has already been fixed by ag0aep6g just 19 days