Re: core.atomic for ldc.

2021-01-31 Thread vitamin via Digitalmars-d-learn
On Monday, 1 February 2021 at 06:38:16 UTC, Basile B. wrote: On Monday, 1 February 2021 at 06:12:59 UTC, vitamin wrote: On Monday, 1 February 2021 at 05:23:52 UTC, rikki cattermole wrote: The only difference between dmd, ldc and gdc (in effect) is the backend. While druntime and Phobos will be

Re: core.atomic for ldc.

2021-01-31 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 February 2021 at 06:12:59 UTC, vitamin wrote: On Monday, 1 February 2021 at 05:23:52 UTC, rikki cattermole wrote: The only difference between dmd, ldc and gdc (in effect) is the backend. While druntime and Phobos will be patched for other platform targets, over all its the same lib

Re: core.atomic for ldc.

2021-01-31 Thread vitamin via Digitalmars-d-learn
On Monday, 1 February 2021 at 05:23:52 UTC, rikki cattermole wrote: The only difference between dmd, ldc and gdc (in effect) is the backend. While druntime and Phobos will be patched for other platform targets, over all its the same library. The same goes for core.atomic. You should not need t

Re: Class Allocators

2021-01-31 Thread evilrat via Digitalmars-d-learn
On Sunday, 31 January 2021 at 23:19:09 UTC, Kyle wrote: My best guess right now is that both class allocators and the placement new syntax are deprecated, but if that's the case I would expect a deprecation message when I try to use that new(address) Type syntax whether there's a class allocato

Re: Class Allocators

2021-01-31 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 31 January 2021 at 23:19:09 UTC, Kyle wrote: strategy outside of the class". My best guess right now is that both class allocators and the placement new syntax are deprecated, but if that's the case I would expect a deprecation message when I try to use that new(address) Type syntax

Re: core.atomic for ldc.

2021-01-31 Thread rikki cattermole via Digitalmars-d-learn
The only difference between dmd, ldc and gdc (in effect) is the backend. While druntime and Phobos will be patched for other platform targets, over all its the same library. The same goes for core.atomic. You should not need to know that it has been patched. If you can call it and it gives you

Class Allocators

2021-01-31 Thread Kyle via Digitalmars-d-learn
I've been doing some review of Andrei's book which has led me to trying to figure out how placement new works, or doesn't work. The new(address) Type syntax tells me "no allocator for TYPE". I did find information on "Class Allocators" at https://dlang.org/spec/class.html#allocators, but when I

Type of string literal concatenated with non-immutable char array

2021-01-31 Thread Per Nordlöw via Digitalmars-d-learn
Given char x[]; why is typeof("a" ~ x) `char[]` when typeof("a" ~ x.idup) is `string`? My case is class NameLookupException : Exception { this(string name) { super("Name " ~ name ~ " could not be found"); } this(scope const(char)[] name) { super

Re: How to profile compile times of a source code?

2021-01-31 Thread Johan via Digitalmars-d-learn
On Sunday, 31 January 2021 at 16:39:12 UTC, Boris Carvajal wrote: On Sunday, 31 January 2021 at 16:13:24 UTC, Anonymouse wrote: Does ldc produce traces in a format that Tracy supports? I can't seem to open the generated *.time-trace files with it. (tracy 0.7.5-1 installed from Arch Linux AUR.)

Re: 200-600x slower Dlang performance with nested foreach loop

2021-01-31 Thread a11e99z via Digitalmars-d-learn
On Sunday, 31 January 2021 at 16:50:15 UTC, methonash wrote: What confuses me, at this point, is this: I originally wrote the D code using foreach in this style: foreach( i, ref parentString; strings ) foreach( j, ref childString; strings[ i + 1 .. $ ] ) Essentially, the value of j printed

Re: 200-600x slower Dlang performance with nested foreach loop

2021-01-31 Thread methonash via Digitalmars-d-learn
On Sunday, 31 January 2021 at 00:53:05 UTC, Steven Schveighoffer wrote: I'd suggest trying it in reverse. If you have the sequence "cba", "ba", "a", then determining "a" is in "ba" is probably cheaper than determining "a" is in "cba". I have user requirements that this application track string

Re: How to profile compile times of a source code?

2021-01-31 Thread Boris Carvajal via Digitalmars-d-learn
On Sunday, 31 January 2021 at 16:13:24 UTC, Anonymouse wrote: On Sunday, 31 January 2021 at 12:31:59 UTC, Johan Engelen wrote: Try LDC 1.25 (now in beta testing) with --ftime-trace. Clang has the same option, so you can read more about it online in that context. Be sure to check out the related

Re: How to profile compile times of a source code?

2021-01-31 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:31:59 UTC, Johan Engelen wrote: Try LDC 1.25 (now in beta testing) with --ftime-trace. Clang has the same option, so you can read more about it online in that context. Be sure to check out the related commandline flags. I recommend the Tracy UI to look at traces

Re: How to capture a BitFlags type in a function parameter?

2021-01-31 Thread realhet via Digitalmars-d-learn
On Sunday, 31 January 2021 at 14:16:15 UTC, Paul Backus wrote: On Sunday, 31 January 2021 at 14:04:00 UTC, realhet wrote: Hi, static void stdUI(E, Flag!"unsafe" u)(ref BitFlags!(E, u) flags) {} Thank You! Somehow I forgot I could pass amd match ANY TYPE in the template parameters. I'll

Re: How to capture a BitFlags type in a function parameter?

2021-01-31 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 31 January 2021 at 14:04:00 UTC, realhet wrote: Hi, I wan't to process every specialization of the BitFlags struct in a function: So far the best I can come up is this: static void stdUI(F)(ref F flags) if(F.stringof.startsWith("BitFlags!(")){} But it's obviously lame. If I tr

How to capture a BitFlags type in a function parameter?

2021-01-31 Thread realhet via Digitalmars-d-learn
Hi, I wan't to process every specialization of the BitFlags struct in a function: So far the best I can come up is this: static void stdUI(F)(ref F flags) if(F.stringof.startsWith("BitFlags!(")){} But it's obviously lame. If I try this way: static void stdUI(E, U)(ref BitFlags!(E, U) f

Re: How to profile compile times of a source code?

2021-01-31 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:31:59 UTC, Johan Engelen wrote: On Sunday, 31 January 2021 at 12:16:50 UTC, Imperatorn wrote: On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: [...] Interesting. Is this something that we could get into dmd with a switch? 🤔 Try LDC 1.25 (now

Re: core.atomic for ldc.

2021-01-31 Thread vitamin via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:51:57 UTC, vitamin wrote: Exists for LDC library like core.atomic? It look like that dub compile with ldc but use dmd runtime and module core.internal.atomic has version only for dmd and gdc. How to make ldc use ldc runtime?

core.atomic for ldc.

2021-01-31 Thread vitamin via Digitalmars-d-learn
Exists for LDC library like core.atomic?

Re: How to profile compile times of a source code?

2021-01-31 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:16:50 UTC, Imperatorn wrote: On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: [...] I have a way of getting the profile data your are after. Get the dmd_tracing_20942 branch from

Re: How to profile compile times of a source code?

2021-01-31 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: [...] I have a way of getting the profile data your are after. Get the dmd_tracing_20942 branch from https://github.com/UplinkCoder/dmd Compile that version of dmd

Re: Minimize GC memory footprint

2021-01-31 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 31 January 2021 at 04:12:14 UTC, frame wrote: On Saturday, 30 January 2021 at 22:57:41 UTC, Imperatorn wrote: On Saturday, 30 January 2021 at 16:42:35 UTC, frame wrote: Is there a way to force the GC to re-use memory in already existing pools? I set maxPoolSize:1 to gain pools that

Re: Minimize GC memory footprint

2021-01-31 Thread Max Haughton via Digitalmars-d-learn
On Saturday, 30 January 2021 at 16:42:35 UTC, frame wrote: Is there a way to force the GC to re-use memory in already existing pools? I set maxPoolSize:1 to gain pools that can be quicker released after there no longer in use. This already reduces memory usage to 1:3. Sadly the application cr