Re: Dr Callahan ports D compiler to OpenBSD

2021-03-21 Thread Brian via Digitalmars-d-announce

On Sunday, 21 March 2021 at 23:56:15 UTC, Johan wrote:
Seeing that pledge/unveil are declared in unistd.d, your work 
should probably land here:

https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d#L2556


Yes, I think so. People who program on OpenBSD expect pledge and 
unveil to always be available, and so having them in druntime is 
better than a separate module.


Re: Dr Callahan ports D compiler to OpenBSD

2021-03-21 Thread Johan via Digitalmars-d-announce

On Sunday, 21 March 2021 at 23:14:36 UTC, Brian wrote:

On Sunday, 21 March 2021 at 22:41:36 UTC, Walter Bright wrote:

https://briancallahan.net/blog/20210320.html


Hi Brian,
  Very nice.

Seeing that pledge/unveil are declared in unistd.d, your work 
should probably land here:

https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d#L2556

Cheers,
  Johan



Re: Dr Callahan ports D compiler to OpenBSD

2021-03-21 Thread Brian via Digitalmars-d-announce

On Sunday, 21 March 2021 at 22:41:36 UTC, Walter Bright wrote:

https://briancallahan.net/blog/20210320.html

https://news.ycombinator.com/item?id=26520996#26531423

https://reddit.com/r/programming/comments/m9xu8s/a_working_d_compiler_on_openbsd/

Thanks to Dr Brian Callahan!


I don't have an HN or Reddit account so I'll reply here.

First, thanks. But second, all I really did was the last mile 
stuff. Lots of people did nearly all of the work before I came 
along, which I hope I made enough mention of in my blog post.


I've also opened a bug report for GDC: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99691
But it looks like Iain was already on it, so I suspect we really 
want to thank him more than me for the GDC parts!


(You also don't have to call me Dr. -- it's there just because 
it's my personal/professional website and I happen to be employed 
as an academic.)


Dr Callahan ports D compiler to OpenBSD

2021-03-21 Thread Walter Bright via Digitalmars-d-announce

https://briancallahan.net/blog/20210320.html

https://news.ycombinator.com/item?id=26520996#26531423

https://reddit.com/r/programming/comments/m9xu8s/a_working_d_compiler_on_openbsd/

Thanks to Dr Brian Callahan!


Re: Silicon Valley D Meetup - March 18, 2021 - "Templates in the D Programming Language" by Ali Çehreli

2021-03-21 Thread Jon Degenhardt via Digitalmars-d-announce

On Friday, 19 March 2021 at 17:10:27 UTC, Ali Çehreli wrote:

Jon mentioned how PR 7678 reduced the performance of 
std.regex.matchOnce. After analyzing the code we realized that 
the performance loss must be due to two delegate context 
allocations:


https://github.com/dlang/phobos/pull/7678/files#diff-269abc020de3a951eaaa5b8eca5a0700ba8b298767c7a64f459e74e1531a80aeR825

One delegate is 'matchOnceImp' and the other one is the 
anonymous delegate created on the return expression.


We understood that 'matchOnceImp' could not be a nested 
function because of an otherwise useful rule: the name of the 
nested function alone would *call* that function instead of 
being a symbol for it. That is not the case for a local 
delegate variable, so that's why 'matchOnceImp' exists as a 
delegate variable there.


Then there is the addition of the 'pure' attribute to it. 
Fine...


After tinkering with the code, we realized that the same effect 
can be achieved with a static member function of a static 
struct, which would not allocate any delegate context. I add 
@nogc to the following code to prove that point. The following 
code is even simpler than Jon and I came up with yesterday.


[... Code snippet removed ...]

There: we injected @trusted code inside a @nogc @safe function.

Question to others: Did we understand the reason for the 
convoluted code in that PR fully? Is the above method really a 
better solution?


I submitted PR 7902 (https://github.com/dlang/phobos/pull/7902) 
to address this. I wasn't able to use the version Ali showed in 
the post, but the PR does use what is essentially the same idea 
identified at the D Meetup. It is a performance regression, and 
is a bit more nuanced than would be ideal. Comments and review 
would be appreciated.


--Jon