Re: Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/9/23 4:24 PM, Cecil Ward wrote: Before I posted a question about avoiding unnecessary allocs/reallocs when adding entries to an array like so     uint[ dstring ]  arr; when I build it up from nothing with successive insertions. The array is accessed by a key that is a dstring. I was told

Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-09 Thread Cecil Ward via Digitalmars-d-learn
Before I posted a question about avoiding unnecessary allocs/reallocs when adding entries to an array like so uint[ dstring ] arr; when I build it up from nothing with successive insertions. The array is accessed by a key that is a dstring. I was told that I can’t use .reserve or the like

Re: Inlined functions and their original bodies - bloat

2023-07-09 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 9 July 2023 at 18:05:48 UTC, Cecil Ward wrote: This is with full -O3 optimisation try -fvisibility=hidden -release sux btw

Re: Inlined functions and their original bodies - bloat

2023-07-09 Thread Cecil Ward via Digitalmars-d-learn
On Sunday, 9 July 2023 at 18:04:13 UTC, Cecil Ward wrote: I have a program where the various routines are all marked pragma( inline, true ). The compiler obeys this but the LDC and GDC compilers still compile the function bodies even though the bodies are not needed as they are supposed to be ‘

Re: Toolchain with ldc and AArch64 OSX

2023-07-09 Thread Cecil Ward via Digitalmars-d-learn
On Sunday, 9 July 2023 at 05:32:56 UTC, Danilo Krahn wrote: On Saturday, 24 June 2023 at 15:16:37 UTC, Cecil Ward wrote: I have LDC running on an ARM Mac. If anyone else out there is an LDC or GDC user, could you knock up a quick shell program to compile and link a .d file to produce an executa

Re: Dynamic array of strings and appending a zero length array

2023-07-09 Thread Cecil Ward via Digitalmars-d-learn
On Saturday, 8 July 2023 at 20:01:08 UTC, H. S. Teoh wrote: On Sat, Jul 08, 2023 at 05:15:26PM +, Cecil Ward via Digitalmars-d-learn wrote: I have a dynamic array of dstrings and I’m spending dstrings to it. At one point I need to append a zero-length string just to increase the length of t

Re: Weird template instantiation speed?

2023-07-09 Thread IchorDev via Digitalmars-d-learn
On Sunday, 9 July 2023 at 14:49:39 UTC, Steven Schveighoffer wrote: This is probably a bug somewhere, 4 seconds is too much. A reduced test case would be helpful. But I wanted to note, inside a struct template, the template name (by itself) is equivalent to the current instantiation. So jus

Re: Linker error, doing something wrong?

2023-07-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/9/23 10:01 AM, Dmitry Olshansky wrote: Trying to compile the following: https://github.com/DmitryOlshansky/photon/blob/master/tests/curl_download.d with: ldc2 curl_download.d -L-lcurl get:   "__D6photon12__ModuleInfoZ", referenced from:   __D13curl_download12__ModuleInfoZ in curl_d

Re: Weird template instantiation speed?

2023-07-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/9/23 7:54 AM, IchorDev wrote: While working on some new bindings, I've discovered that if `opAssign` in a struct template "`BindingTempl(T)`" has the return type "`BindingTempl!T` then it adds about 4 seconds to the compile time per instantiation of `BindingTempl`. The added compile time i

Linker error, doing something wrong?

2023-07-09 Thread Dmitry Olshansky via Digitalmars-d-learn
Trying to compile the following: https://github.com/DmitryOlshansky/photon/blob/master/tests/curl_download.d with: ldc2 curl_download.d -L-lcurl get: "__D6photon12__ModuleInfoZ", referenced from: __D13curl_download12__ModuleInfoZ in curl_download.o "__D6photon5macos4core2goFDFZvZv",

Re: Warning The package will no longer be detected starting from v1.42.0

2023-07-09 Thread IchorDev via Digitalmars-d-learn
On Monday, 26 June 2023 at 01:35:07 UTC, Soulsbane wrote: Yeah, each folder under libs is a package and it's own git repository. I think I'll just use the add-local approach. Kind of a pain but getting spammed with a page of warnings every compile is getting tiring :). Thanks a lot for the he

Weird template instantiation speed?

2023-07-09 Thread IchorDev via Digitalmars-d-learn
While working on some new bindings, I've discovered that if `opAssign` in a struct template "`BindingTempl(T)`" has the return type "`BindingTempl!T` then it adds about 4 seconds to the compile time per instantiation of `BindingTempl`. The added compile time is much lower if a function other th

Re: Toolchain with ldc and AArch64 OSX

2023-07-09 Thread Danilo via Digitalmars-d-learn
Forgot the following flags: `-L=-merge_zero_fill_sections -L=-no_exported_symbols -L=-no_eh_labels -L=-dead_strip_dylibs` So the full command is: ``` ldc2 --release --O3 --flto=full -fvisibility=hidden -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L=-dead_strip -L=-x -L=-S -L=-lz -L=-merge_ze

Re: `static` on module-level functions

2023-07-09 Thread IchorDev via Digitalmars-d-learn
On Friday, 7 July 2023 at 13:31:59 UTC, Steven Schveighoffer wrote: D allows no-op attributes in many cases because you can possibly apply attributes to a group via `attribute:` or `attribute { ... }`, and you may not want to fine-tune which things can get the attribute to avoid errors. Her