Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 05:44:37 UTC, Ali Çehreli wrote: On 1/24/21 2:28 AM, IGotD- wrote: > [...] course. Any > [...] not do D > [...] [...] Hmm, interesting, or what you should call it  With this knowledge we have now, what changes could and/or should be made to make this

Re: Why filling AA in shared library freezes execution?

2021-01-30 Thread Siemargl via Digitalmars-d-learn
On Friday, 29 January 2021 at 10:10:56 UTC, frame wrote: On Friday, 29 January 2021 at 01:23:20 UTC, Siemargl wrote: On Friday, 29 January 2021 at 00:45:12 UTC, Siemargl wrote: Then i modify program, just removing DLL, copying TestFun() in main module and it runs. Same compiler -m64 target.

Re: Why filling AA in shared library freezes execution?

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Friday, 29 January 2021 at 15:34:49 UTC, H. S. Teoh wrote: On Fri, Jan 29, 2021 at 12:45:02PM +, Imperatorn via Digitalmars-d-learn wrote: On Wednesday, 27 January 2021 at 15:25:17 UTC, H. S. Teoh wrote: > On Wed, Jan 27, 2021 at 02:39:08PM +, Adam D. Ruppe via > Digitalmars-d-learn

Bit rotation question/challenge

2021-01-30 Thread burt via Digitalmars-d-learn
I have a static array of `ubyte`s of arbitrary size: ```d ubyte[4] x = [ // in reality, ubyte[64] 0b1000, 0b0001, 0b00010101, 0b0010, ]; ``` Now I want to bit-rotate the array as if it is one big integer. So: ```d ubyte[n] rotateRight(size_t n)(ref const ubyte[n]

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread IGotD- via Digitalmars-d-learn
On Saturday, 30 January 2021 at 12:28:16 UTC, Ali Çehreli wrote: I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails because the thread may be dead already. However, studying the runtime code around

Re: Bit rotation question/challenge

2021-01-30 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: I have a static array of `ubyte`s of arbitrary size: ```d ubyte[4] x = [ // in reality, ubyte[64] 0b1000, 0b0001, 0b00010101, 0b0010, ]; ``` Now I want to bit-rotate the array as if it is one big integer.

Re: Bit rotation question/challenge

2021-01-30 Thread Afgdr via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:56:14 UTC, burt wrote: On Saturday, 30 January 2021 at 14:41:59 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 14:40:49 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: [...] cast as uint and shift. cast the result as

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Ali Çehreli via Digitalmars-d-learn
On 1/30/21 1:34 AM, Imperatorn wrote: > With this knowledge we have now, what changes could and/or should be > made to make this process easier? 樂 I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails

Minimize GC memory footprint

2021-01-30 Thread frame via Digitalmars-d-learn
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 creates multiple pools that are not necessary in my POV -

Re: Bit rotation question/challenge

2021-01-30 Thread burt via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:17:06 UTC, Paul Backus wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: [...] Now I want to bit-rotate the array as if it is one big integer. You may find `std.bitmanip.BitArray` useful for this:

Re: Bit rotation question/challenge

2021-01-30 Thread burt via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:41:59 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 14:40:49 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: [...] cast as uint and shift. cast the result as ubyte[4]. obiously, that works for n=4 with uint and n=8 for

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 12:28:16 UTC, Ali Çehreli wrote: On 1/30/21 1:34 AM, Imperatorn wrote: > [...] should be > [...] I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails because the thread

Re: Bit rotation question/challenge

2021-01-30 Thread Afgdr via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:40:49 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: I have a static array of `ubyte`s of arbitrary size: ```d ubyte[4] x = [ // in reality, ubyte[64] 0b1000, 0b0001, 0b00010101, 0b0010, ]; ``` Now I

Re: Bit rotation question/challenge

2021-01-30 Thread Afgdr via Digitalmars-d-learn
On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: I have a static array of `ubyte`s of arbitrary size: ```d ubyte[4] x = [ // in reality, ubyte[64] 0b1000, 0b0001, 0b00010101, 0b0010, ]; ``` Now I want to bit-rotate the array as if it is one big integer.

Re: emplace doesn't forward aeguments

2021-01-30 Thread vitamin via Digitalmars-d-learn
On Thursday, 28 January 2021 at 23:18:21 UTC, kinke wrote: On Thursday, 28 January 2021 at 21:15:49 UTC, vitamin wrote: Is there reason why std.conv.emplace doesn't forward arguments to __ctor? Yeah, a bug in the emplace() version for classes, some missing `forward!args` in there (it works

Re: Bit rotation question/challenge

2021-01-30 Thread vitamin via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:56:14 UTC, burt wrote: On Saturday, 30 January 2021 at 14:41:59 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 14:40:49 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: [...] cast as uint and shift. cast the result as

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

2021-01-30 Thread methonash via Digitalmars-d-learn
Greetings all, Many thanks for sharing your collective perspective and advice thus far! It has been very helpful and instructive. I return bearing live data and a minimally complete, compilable, and executable program to experiment with and potentially optimize. The dataset can be pulled

Re: Minimize GC memory footprint

2021-01-30 Thread frame via Digitalmars-d-learn
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 can be quicker released after there no longer in use.

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

2021-01-30 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: this special version of dmd will generate a trace file which can be read with the included printTraceHeader tool you will want to take a look at the PhaseHist command which shows you the compiler phase that took the most time.

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

2021-01-30 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: I'm looking for ways to figure out what parts of the code slows down the compiler other than brute force trial. Can I use -vtemplates switch for this? Would -v (verbose) switch helpful in some way? How would I know if my

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

2021-01-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/21 6:13 PM, methonash wrote: Greetings all, Many thanks for sharing your collective perspective and advice thus far! It has been very helpful and instructive. I return bearing live data and a minimally complete, compilable, and executable program to experiment with and potentially

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

2021-01-30 Thread CraigDillabaugh via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 23:57:43 UTC, methonash wrote: clip That nested loop is an O(n^2) algorithm. Meaning it will slow down *very* quickly as the size of the array n increases. You might want to think about how to improve this algorithm. Nice observation, and yes, this would

How to profile compile times of a source code?

2021-01-30 Thread Ahmet Sait via Digitalmars-d-learn
I'm looking for ways to figure out what parts of the code slows down the compiler other than brute force trial. Can I use -vtemplates switch for this? Would -v (verbose) switch helpful in some way? How would I know if my bottleneck is ctfe or templates? How do the compiler devs approach this

Re: Why filling AA in shared library freezes execution?

2021-01-30 Thread Vitalii via Digitalmars-d-learn
On Friday, 29 January 2021 at 01:23:20 UTC, Siemargl wrote: On Friday, 29 January 2021 at 00:45:12 UTC, Siemargl wrote: Then i modify program, just removing DLL, copying TestFun() in main module and it runs. Same compiler -m64 target. Ups. Sorry, I just forget copy test_dll.dll inside VM

Re: Why filling AA in shared library freezes execution?

2021-01-30 Thread Siemargl via Digitalmars-d-learn
On Saturday, 30 January 2021 at 19:52:09 UTC, Vitalii wrote: On Friday, 29 January 2021 at 01:23:20 UTC, Siemargl wrote: On Friday, 29 January 2021 at 00:45:12 UTC, Siemargl wrote: Then i modify program, just removing DLL, copying TestFun() in main module and it runs. Same compiler -m64

Re: Minimize GC memory footprint

2021-01-30 Thread Imperatorn 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