Re: Mir Random [WIP]

2016-11-24 Thread Andrea Fontana via Digitalmars-d
On Wednesday, 23 November 2016 at 17:31:58 UTC, Kagamin wrote: On Wednesday, 23 November 2016 at 01:28:11 UTC, Andrei Alexandrescu wrote: Interesting. Could you please add a couple of links about that? -- Andrei http://xoroshiro.di.unimi.it/ Very short public domain implementation: http://xo

Re: How do we accelerate the development of precise GC, RC and so on?

2016-11-24 Thread Jack Applegame via Digitalmars-d
So, who wants to do a good deed and make some money? We can create an issue and start fundraising on Bountysource. We can also donate to the D Language Foundation, but I personally would like to see the funds were used to develop precise GC and DIP74 (https://wiki.dlang.org/DIP74).

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Wednesday, 23 November 2016 at 21:18:27 UTC, Andrei Alexandrescu wrote: [Details needed] I just took a look https://godbolt.org/g/EMy6X4, it's happening. That's three instructions instead of one shr eax,1

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Wednesday, 23 November 2016 at 19:40:47 UTC, Ilya Yaroshenko wrote: Current adaptor should be used in a function scope. (Would be great to have a DIP for that kind of semantic check). An RC adaptor can be added too. First we need to find a real world use case where we need to store a random

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Wednesday, 23 November 2016 at 21:33:53 UTC, Jonathan M Davis wrote: though I think that using the comma operator like that is deprecated now. Adding a helper function such as auto getNext(R)(ref R range) if(isInputRange!R) { range.popFront(); return range.front; } would solve t

Re: Mir Random [WIP]

2016-11-24 Thread Timon Gehr via Digitalmars-d
On 24.11.2016 09:55, Kagamin wrote: On Wednesday, 23 November 2016 at 21:18:27 UTC, Andrei Alexandrescu wrote: [Details needed] I just took a look https://godbolt.org/g/EMy6X4, it's happening. That's three instructions instead of one shr eax,1 That would be wrong code. Cast to int after div

Re: Mir Random [WIP]

2016-11-24 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 24 November 2016 at 08:59:03 UTC, Kagamin wrote: On Wednesday, 23 November 2016 at 19:40:47 UTC, Ilya Yaroshenko wrote: Current adaptor should be used in a function scope. (Would be great to have a DIP for that kind of semantic check). An RC adaptor can be added too. First we need

Re: Mir Random [WIP]

2016-11-24 Thread Ilya Yaroshenko via Digitalmars-d
On Wednesday, 23 November 2016 at 16:54:44 UTC, Andrei Alexandrescu wrote: On 11/23/2016 10:52 AM, Ilya Yaroshenko wrote: I started with Engines as basis. The library will be very different comparing with Phobos and _any_ other RNG libraries in terms of floating point generation quality. All F

Re: Mir Random [WIP]

2016-11-24 Thread Timon Gehr via Digitalmars-d
On 23.11.2016 00:55, Andrei Alexandrescu wrote: On 11/22/16 1:31 AM, Ilya Yaroshenko wrote: - `opCall` API instead of range interface is used (similar to C++) This seems like a gratuitous departure from common D practice. Random number generators are most naturally modeled in D as infinite ra

Re: Mir Random [WIP]

2016-11-24 Thread John Colvin via Digitalmars-d
On Thursday, 24 November 2016 at 08:55:18 UTC, Kagamin wrote: On Wednesday, 23 November 2016 at 21:18:27 UTC, Andrei Alexandrescu wrote: [Details needed] I just took a look https://godbolt.org/g/EMy6X4, it's happening. That's three instructions instead of one shr eax,1 That's because of th

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Thursday, 24 November 2016 at 09:46:16 UTC, John Colvin wrote: That's because of the cast(int), dividing by two is optimised just fine. What about Andrei's example?

Re: Mir Random [WIP]

2016-11-24 Thread John Colvin via Digitalmars-d
On Thursday, 24 November 2016 at 10:14:27 UTC, Kagamin wrote: On Thursday, 24 November 2016 at 09:46:16 UTC, John Colvin wrote: That's because of the cast(int), dividing by two is optimised just fine. What about Andrei's example? I was talking about andrei's example. He has a cast(int) in it

Re: CTFE Status

2016-11-24 Thread Stefan Koch via Digitalmars-d
On Monday, 21 November 2016 at 19:19:50 UTC, Stefan Koch wrote: On Monday, 21 November 2016 at 19:11:58 UTC, Anonymouse wrote: On Sunday, 20 November 2016 at 09:02:30 UTC, Stefan Koch wrote: On Saturday, 19 November 2016 at 11:22:18 UTC, Stefan Koch wrote: [...] I would buy you a beer but the

Re: Detect that a child is waiting for input

2016-11-24 Thread unDEFER via Digitalmars-d
On Wednesday, 23 November 2016 at 07:18:27 UTC, Shachar Shemesh wrote: The shell does that for background processes. I think it takes away the TTY from its children, and this way, when they try to read from stdin, they get SIGSTOP from the system. I'm not sure what the precise mechanism is.

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Thursday, 24 November 2016 at 10:16:11 UTC, John Colvin wrote: I was talking about andrei's example. He has a cast(int) in it before the division. And you think that compilation of cast(int)a.length/2 to 3 instructions is optimized just fine? How is it better that one shift?

Re: Detect that a child is waiting for input

2016-11-24 Thread unDEFER via Digitalmars-d
Here is good information about difference between foreground process groups and background: https://www.win.tue.nl/~aeb/linux/lk/lk-10.html Shortly, there is only one process group which is foreground, you can get it with tcgetpgrp(fd) or set it with tcsetpgrp(fd,pgrp). To setup process group

Re: Mir Random [WIP]

2016-11-24 Thread John Colvin via Digitalmars-d
On Thursday, 24 November 2016 at 10:41:44 UTC, Kagamin wrote: On Thursday, 24 November 2016 at 10:16:11 UTC, John Colvin wrote: I was talking about andrei's example. He has a cast(int) in it before the division. And you think that compilation of cast(int)a.length/2 to 3 instructions is optimi

Re: Detect that a child is waiting for input

2016-11-24 Thread Shachar Shemesh via Digitalmars-d
You can detect whether another process received a signal by ptracing it. If you are only ptracing for signals, then the performance penalty shouldn't be too severe. Shachar On 24/11/16 12:35, unDEFER wrote: On Wednesday, 23 November 2016 at 07:18:27 UTC, Shachar Shemesh wrote: The shell doe

Re: Mir Random [WIP]

2016-11-24 Thread Jonathan M Davis via Digitalmars-d
On Thursday, November 24, 2016 09:05:34 Kagamin via Digitalmars-d wrote: > On Wednesday, 23 November 2016 at 21:33:53 UTC, Jonathan M Davis > > wrote: > > though I think that using the comma operator like that is > > deprecated now. Adding a helper function such as > > > > auto getNext(R)(ref R ran

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Thursday, 24 November 2016 at 12:02:22 UTC, John Colvin wrote: Because it's correct. If a.length is larger than int.max then cast(int)a.length will half the time be negative and therefore a simple rightshift would not be equivalent to division by 2. It can't be possibly correct when a.lengt

Re: Mir Random [WIP]

2016-11-24 Thread Kagamin via Digitalmars-d
On Thursday, 24 November 2016 at 13:45:40 UTC, Jonathan M Davis wrote: How so? Because someone might call range.front again without bothering to call popFront? That's what everything in std.algorithm does.

Re: Mir Random [WIP]

2016-11-24 Thread Jonathan M Davis via Digitalmars-d
On Thursday, November 24, 2016 13:54:50 Kagamin via Digitalmars-d wrote: > On Thursday, 24 November 2016 at 13:45:40 UTC, Jonathan M Davis > > wrote: > > How so? Because someone might call range.front again without > > bothering to call popFront? > > That's what everything in std.algorithm does. T

Re: Detect that a child is waiting for input

2016-11-24 Thread unDEFER via Digitalmars-d
The program which stops even run without "&": #!/usr/bin/rdmd import std.stdio; import std.file; import std.string; import core.sys.posix.unistd; import core.stdc.errno; import core.stdc.string; void main() { int res = core.sys.posix.unistd.tcsetpgrp(0, getppid()); if (res != 0) {

Re: Mir Random [WIP]

2016-11-24 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 24 November 2016 at 13:45:40 UTC, Jonathan M Davis wrote: Alternatively, you could just do rndGen().take(1).front, and as long as rndGen() gives you a reference type, it works just fine. Unfortunately, std.random did not use reference types for its ranges. _That_ is the big mistake

Re: Mir Random [WIP]

2016-11-24 Thread John Colvin via Digitalmars-d
On Thursday, 24 November 2016 at 16:09:23 UTC, Ilya Yaroshenko wrote: On Thursday, 24 November 2016 at 13:45:40 UTC, Jonathan M Davis wrote: Alternatively, you could just do rndGen().take(1).front, and as long as rndGen() gives you a reference type, it works just fine. Unfortunately, std.random

Re: CTFE Status

2016-11-24 Thread Stefan Koch via Digitalmars-d
I have just discovered breakage of basic operations. I will need regression tests, some time soon.

Re: Mir Random [WIP]

2016-11-24 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 24 November 2016 at 17:04:43 UTC, John Colvin wrote: If druntime was initialised by default using __attribute__((constructor)) for static and linker .init for shared libraries, would that be good enough for you*? I feel like you're limiting your design choices because of a relat

Re: Mir Random [WIP]

2016-11-24 Thread Timon Gehr via Digitalmars-d
On 24.11.2016 14:50, Kagamin wrote: On Thursday, 24 November 2016 at 12:02:22 UTC, John Colvin wrote: Because it's correct. If a.length is larger than int.max then cast(int)a.length will half the time be negative and therefore a simple rightshift would not be equivalent to division by 2. It ca

ESA's Schiaparelli Mars probe crashed because of integer overflow

2016-11-24 Thread qznc via Digitalmars-d
Although, the article [0] does not say that literally, it sounds like an integer overflow: After trawling through mountains of data, the European Space Agency said Wednesday that while much of the mission went according to plan, a computer that measured the rotation of the lander hit a maximu

Re: ESA's Schiaparelli Mars probe crashed because of integer overflow

2016-11-24 Thread Timon Gehr via Digitalmars-d
On 24.11.2016 20:49, qznc wrote: Although, the article [0] does not say that literally, it sounds like an integer overflow: After trawling through mountains of data, the European Space Agency said Wednesday that while much of the mission went according to plan, a computer that measured the rota

OT: for (;;) {} vs while (true) {}

2016-11-24 Thread Dennis Ritchie via Digitalmars-d
Hi all, In the source code, written in D, is often used in the design of the `for (;;) { ... }` Maybe someone has specific examples of translation of code in asm, where `while (true) { ... }` or `for (;;) { ... }` affect the performance or cross-platform programs. It would be interesting to

Re: OT: for (;;) {} vs while (true) {}

2016-11-24 Thread LiNbO3 via Digitalmars-d
On Thursday, 24 November 2016 at 21:57:15 UTC, Dennis Ritchie wrote: Hi all, In the source code, written in D, is often used in the design of the `for (;;) { ... }` Maybe someone has specific examples of translation of code in asm, where `while (true) { ... }` or `for (;;) { ... }` affect t

Re: OT: for (;;) {} vs while (true) {}

2016-11-24 Thread Dennis Ritchie via Digitalmars-d
On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote: As you can see [1] the `while (true)` is lowered into `for (;true;)` so it's all about what construct pleases you the most. [1] https://github.com/dlang/dmd/blob/cd451ceae40d04f7371e46df1c955fd914f3085f/src/statementsem.d#L357 OK,

Re: Mir Random [WIP]

2016-11-24 Thread Joseph Rushton Wakeling via Digitalmars-d
On Thursday, 24 November 2016 at 08:36:41 UTC, Andrea Fontana wrote: On Wednesday, 23 November 2016 at 17:31:58 UTC, Kagamin wrote: On Wednesday, 23 November 2016 at 01:28:11 UTC, Andrei Alexandrescu wrote: Interesting. Could you please add a couple of links about that? -- Andrei http://xoros

Re: OT: for (;;) {} vs while (true) {}

2016-11-24 Thread Andrei Alexandrescu via Digitalmars-d
On 11/24/2016 05:09 PM, Dennis Ritchie wrote: On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote: As you can see [1] the `while (true)` is lowered into `for (;true;)` so it's all about what construct pleases you the most. [1] https://github.com/dlang/dmd/blob/cd451ceae40d04f7371e46df1c

Re: ESA's Schiaparelli Mars probe crashed because of integer overflow

2016-11-24 Thread Patrick Schluter via Digitalmars-d
On Thursday, 24 November 2016 at 20:22:00 UTC, Timon Gehr wrote: On 24.11.2016 20:49, qznc wrote: Although, the article [0] does not say that literally, it sounds like an integer overflow: After trawling through mountains of data, the European Space Agency said Wednesday that while much of th

Re: OT: for (;;) {} vs while (true) {}

2016-11-24 Thread unDEFER via Digitalmars-d
Why you consider only 2 options? Use "do {} while (true);" :-)

Re: TechEmpower Web Framework Performance Comparison Round 13 -- vibe.d non-starter?

2016-11-24 Thread Daniel Kozak via Digitalmars-d
On Thursday, 17 November 2016 at 17:49:09 UTC, sanjayss wrote: https://www.techempower.com/benchmarks/#section=data-r13&hw=ph&test=json anyone know why vibe.d is shown as "Did not complete" in all tests? So I have investigated it and find out the reason is probably some memory leak. It is im