www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Simplifying druntime and phobos by getting rid of "shared static

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
https://github.com/dlang/phobos/pull/5421

Looking forward to more in the same vein, please contribute! We have 25 
left in phobos and 12 in druntime. A big one will be making the GC 
lazily initialize itself. -- Andrei
May 23
next sibling parent reply David Nadlinger <code klickverbot.at> writes:
On Tuesday, 23 May 2017 at 19:47:49 UTC, Andrei Alexandrescu 
wrote:
 A big one will be making the GC lazily initialize itself.
How detailed are your plans for this? The interaction between GC and shared library loading is a bit non-trivial to get right. — David
May 23
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 05/23/2017 04:34 PM, David Nadlinger wrote:
 On Tuesday, 23 May 2017 at 19:47:49 UTC, Andrei Alexandrescu wrote:
 A big one will be making the GC lazily initialize itself.
How detailed are your plans for this? The interaction between GC and shared library loading is a bit non-trivial to get right. — David
Not too detailed, and that why I'm counting for experts such as yourself. -- Andrei
May 23
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 05/23/2017 03:47 PM, Andrei Alexandrescu wrote:
 https://github.com/dlang/phobos/pull/5421
 
 Looking forward to more in the same vein, please contribute! We have 25 
 left in phobos and 12 in druntime. A big one will be making the GC 
 lazily initialize itself. -- Andrei
In the same vein: https://github.com/dlang/phobos/pull/5423 -- Andrei
May 23
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/23/17 4:42 PM, Andrei Alexandrescu wrote:
 On 05/23/2017 03:47 PM, Andrei Alexandrescu wrote:
 https://github.com/dlang/phobos/pull/5421

 Looking forward to more in the same vein, please contribute! We have
 25 left in phobos and 12 in druntime. A big one will be making the GC
 lazily initialize itself. -- Andrei
In the same vein: https://github.com/dlang/phobos/pull/5423 -- Andrei
This one I 100% agree with! -Steve
May 24
prev sibling parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/23/17 3:47 PM, Andrei Alexandrescu wrote:
 https://github.com/dlang/phobos/pull/5421

 Looking forward to more in the same vein, please contribute! We have 25
 left in phobos and 12 in druntime. A big one will be making the GC
 lazily initialize itself. -- Andrei
So every time I do: writeln(...) It has to go through a check to see if it's initialized? Using a delegate? Has the performance of this been tested? I agree the stdiobase thing is ugly. We could also fix this by improving the cycle detection mechanism (e.g. you could tag the static ctor that initializes the handles to say it doesn't depend on any other static ctors, and just put it in stdio). -Steve
May 24
next sibling parent Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Wednesday, 24 May 2017 at 15:49:58 UTC, Steven Schveighoffer 
wrote:
 On 5/23/17 3:47 PM, Andrei Alexandrescu wrote:
 https://github.com/dlang/phobos/pull/5421

 Looking forward to more in the same vein, please contribute! 
 We have 25
 left in phobos and 12 in druntime. A big one will be making 
 the GC
 lazily initialize itself. -- Andrei
So every time I do: writeln(...) It has to go through a check to see if it's initialized? Using a delegate?
It also copies every argument four times.
May 24
prev sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 5/24/17 4:49 PM, Steven Schveighoffer wrote:
 On 5/23/17 3:47 PM, Andrei Alexandrescu wrote:
 https://github.com/dlang/phobos/pull/5421

 Looking forward to more in the same vein, please contribute! We have 25
 left in phobos and 12 in druntime. A big one will be making the GC
 lazily initialize itself. -- Andrei
So every time I do: writeln(...) It has to go through a check to see if it's initialized? Using a delegate?
The delegate is not called in the steady state.
 Has the performance of this been tested?
Always a good idea. My test bed: void main() { import std.stdio; foreach (i; 0 .. 10_000_000) writeln("1234567890"); } On my laptop using dmd, phobos master, best of 21 runs using "time test
/dev/null": 1.371 seconds.
With initOnce: 1.469 seconds. Yuck! So I added double checking: https://github.com/dlang/phobos/pull/5421/commits/6ef3b5a6eacfe82239b7bbc4b0bc9f38adc6fe91 With the double checking: 1.372 seconds. So back to sanity. Thanks for asking me to measure! Andrei
May 24
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/24/17 12:40 PM, Andrei Alexandrescu wrote:
 On 5/24/17 4:49 PM, Steven Schveighoffer wrote:
 On 5/23/17 3:47 PM, Andrei Alexandrescu wrote:
 https://github.com/dlang/phobos/pull/5421

 Looking forward to more in the same vein, please contribute! We have 25
 left in phobos and 12 in druntime. A big one will be making the GC
 lazily initialize itself. -- Andrei
So every time I do: writeln(...) It has to go through a check to see if it's initialized? Using a delegate?
The delegate is not called in the steady state.
OK, I worry about inlineability as DMD has issues when you are using delegates sometimes. Unfortunately, I think the compiler isn't smart enough to realize that after one check of the boolean returns true, it could just access the File handle directly.
 Has the performance of this been tested?
Always a good idea. My test bed: void main() { import std.stdio; foreach (i; 0 .. 10_000_000) writeln("1234567890"); } On my laptop using dmd, phobos master, best of 21 runs using "time test
/dev/null": 1.371 seconds.
With initOnce: 1.469 seconds. Yuck! So I added double checking: https://github.com/dlang/phobos/pull/5421/commits/6ef3b5a6eacfe82239b7bbc4b0bc9f38adc6fe91 With the double checking: 1.372 seconds. So back to sanity. Thanks for asking me to measure!
This is pretty decent. I still prefer the static ctor solution, but this is workable. -Steve
May 24
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
BTW the best outcome of this is a faster initOnce. Steve, take a look at 
it pliz pliz? -- Andrei
May 24