Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread frame via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 06:53:22 UTC, Vitalii wrote: It's quite unexpected for me that nobody give me some help about usage of AA in shared library. Nobody use shared library? Nobody use AA? Post with trivial questions about OpAssign gets many answers. Even post about changing logo colo

Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread Vitalii via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 08:14:10 UTC, frame wrote: On Tuesday, 26 January 2021 at 06:53:22 UTC, Vitalii wrote: It's quite unexpected for me that nobody give me some help about usage of AA in shared library. Nobody use shared library? Nobody use AA? Post with trivial questions about OpA

Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread frame via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 11:17:11 UTC, Vitalii wrote: I'll be waiting for bugfix release. There could also be other reasons if your system is "compromised" by a Hijack-DLL thats automatically included when your app starts by an Anti-Virus scanner or some bug in a C++ updated or outdate

Compile time check for GC?

2021-01-26 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
Is there some way for library authors to test whether a GC is present at compile time? @nogc just means that my code does not depend on a GC, but it doesn't tell the compiler that my code is incompatible with GC. I want to compute pointers in a way that is not scannable by a conservative coll

Re: Can I set the base class like this?

2021-01-26 Thread vitamin via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 04:39:07 UTC, Jack wrote: Can I pass the base class type thought template parameter? something like this: [...] You have it almost right: class C(alias T) // Template is not type but symbol.

Re: How do I overload += operator?

2021-01-26 Thread bachmeier via Digitalmars-d-learn
On Monday, 25 January 2021 at 17:09:22 UTC, Jack wrote: I'd like to make this work s += 10 where s is a struct. How can I do that? You have your answer, but someone else might come upon this in the future, so here's a link to the clearest explanation of operator overloading for someone new to

Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 25 January 2021 at 21:48:10 UTC, Vitalii wrote: Q: Why filling assoc.array in shared library freeze execution? D exes loading D dlls are very broken on Windows. You can kinda make it work but there's a lot of bad design and showstopper bugs. That's the sad reality of it. I'd sugge

Re: Can I set the base class like this?

2021-01-26 Thread frame via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 04:39:07 UTC, Jack wrote: note the body is the same, what changes is the base class. I'd like to avoid repeating myself when the body is the same and only the base class changes. You would have to call it with correct instantiation like alias Foo = C!(A!bool);

Re: F*cked by memory corruption after assiging value to associative array

2021-01-26 Thread frame via Digitalmars-d-learn
On Monday, 25 January 2021 at 17:11:37 UTC, frame wrote: Wrong way? Please, someone correct me if I'm getting this wrong: Structure: EXE/Main Thread: - GC: manual - requests DLL 1 object A - GC knows about object A DLL/Thread 1: - GC: conservative - allocates new object A -> addRoot(object A

Using mir to work with matrices

2021-01-26 Thread drug via Digitalmars-d-learn
It is not easy to understand what mir library one should use to work with matrices. mir-glas turns out unsupported now and I try to use mir-blas. I need to reimplement my Kalman filter version to use more high dimension matrix than 4x4 plus Kronecker product. Is mir-blas recommended to work wit

Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread Vitalii via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 14:12:17 UTC, Adam D. Ruppe wrote: On Monday, 25 January 2021 at 21:48:10 UTC, Vitalii wrote: Q: Why filling assoc.array in shared library freeze execution? D exes loading D dlls are very broken on Windows. You can kinda make it work but there's a lot of bad des

Re: How to covert dchar and wchar to string?

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/25/21 1:45 PM, Rempas wrote: Actually what the title says. For example I have dchar c = '\u03B3'; and I want to make it into string. I don't want to use "to!string(c);". Any help? That's EXACTLY what you want to use, if what you want is a string. If you just want a conversion to a char a

Re: Compile time check for GC?

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 8:10 AM, Ola Fosheim Grøstad wrote: Is there some way for library authors to test whether a GC is present at compile time? @nogc just means that my code does not depend on a GC, but it doesn't tell the compiler that my code is incompatible with GC. I want to compute pointers in a wa

Re: Can I set the base class like this?

2021-01-26 Thread Jack via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 14:12:21 UTC, vitamin wrote: On Tuesday, 26 January 2021 at 04:39:07 UTC, Jack wrote: Can I pass the base class type thought template parameter? something like this: [...] You have it almost right: class C(alias T) // Template is not type but symbol. Th

Re: Can I set the base class like this?

2021-01-26 Thread Jack via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 14:15:25 UTC, frame wrote: On Tuesday, 26 January 2021 at 04:39:07 UTC, Jack wrote: note the body is the same, what changes is the base class. I'd like to avoid repeating myself when the body is the same and only the base class changes. You would have to call it

Re: Compile time check for GC?

2021-01-26 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 15:30:09 UTC, Steven Schveighoffer wrote: The only way to ensure the GC isn't used is with betterC. Even with @nogc tag on main, the GC could be used in static ctors, and casting function pointers/etc. Yes, @nogc is not strong enough... It is for a container libr

dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
I have a bug report in mysql-native that if you try to create the following file, and add mysql-native as a dependency it fails to link on Windows 10: import std.stdio; import mysql; void main() { writeln("Edit source/app.d to start your project."); } You might recognize that as the d

Re: Compile time check for GC?

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 11:00 AM, Ola Fosheim Grøstad wrote: On Tuesday, 26 January 2021 at 15:30:09 UTC, Steven Schveighoffer wrote: The only way to ensure the GC isn't used is with betterC. Even with @nogc tag on main, the GC could be used in static ctors, and casting function pointers/etc. Yes, @nogc i

Re: Compile time check for GC?

2021-01-26 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 16:08:15 UTC, Steven Schveighoffer wrote: std.traits.hasAliasing? I guess, but it will limit me too much. I should accept Element types that manage their own memory and has pointers to sub-ojects that don't point to GC memory. But I guess that would require a l

Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread Siemargl via Digitalmars-d-learn
Vitalii, I test your program and it runs without any problem. Consuming about 1Gb RAM at end. But i have а slightly different environment. Win10 1909 x64, DMD32 D Compiler v2.092.1-dirty

Re: Why filling AA in shared library freezes execution?

2021-01-26 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 26, 2021 at 02:12:17PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Monday, 25 January 2021 at 21:48:10 UTC, Vitalii wrote: > > Q: Why filling assoc.array in shared library freeze execution? > > D exes loading D dlls are very broken on Windows. You can kinda make > it work

200-600x slower Dlang performance with nested foreach loop

2021-01-26 Thread methonash via Digitalmars-d-learn
Greetings Dlang wizards, I seek knowledge/understanding of a very frustrating phenomenon I've experienced over the past several days. The problem space: 1) Read a list of strings from a file 2) De-duplicate all strings into the subset of unique strings 3) Sort the subset of unique strings by

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

2021-01-26 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 17:40:36 UTC, methonash wrote: foreach( i, ref pStr; sortedArr ) { foreach( j, ref cStr; sortedArr[ i + 1 .. $ ] ) { if( indexOf( pStr, cStr ) > -1 ) { // ... } } } Before adding the code excerpt above, the Dlang prog

is core Mutex lock "fast"?

2021-01-26 Thread ludo via Digitalmars-d-learn
Hi guys, still working on old D1 code, to be updated to D2. At some point the previous dev wrote a FastLock class. The top comment is from the dev himself, not me. My question is after the code. --- class FastLock { protected Mutex mutex; protected int lockCount; prot

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

2021-01-26 Thread methonash via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 17:56:22 UTC, Paul Backus wrote: It would be much easier for us to help you with this if you could post the full program, or at the very least a reduced version that reproduces the same issue. [1] Since your attempts so far have failed to fix the problem, it is

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

2021-01-26 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 17:40:36 UTC, methonash wrote: Greetings Dlang wizards, I seek knowledge/understanding of a very frustrating phenomenon I've experienced over the past several days. [...] Source please 👍

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

2021-01-26 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 26, 2021 at 05:40:36PM +, methonash via Digitalmars-d-learn wrote: [...] > 1) Read a list of strings from a file > 2) De-duplicate all strings into the subset of unique strings > 3) Sort the subset of unique strings by descending length and then by > ascending lexicographic identit

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

2021-01-26 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 26, 2021 at 06:13:54PM +, methonash via Digitalmars-d-learn wrote: [...] > I cannot post the full source code. Then we are limited in how much we can help you. > Regarding a reduced version reproducing the issue: well, that's > exactly what the nested foreach loop does. Without

Re: dustmite on dub project

2021-01-26 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 16:04:29 UTC, Steven Schveighoffer wrote: I have a bug report in mysql-native that if you try to create the following file, and add mysql-native as a dependency it fails to link on Windows 10: import std.stdio; import mysql; void main() { writeln("Edit s

Re: dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 1:33 PM, Andre Pany wrote: On Tuesday, 26 January 2021 at 16:04:29 UTC, Steven Schveighoffer wrote: I have a bug report in mysql-native that if you try to create the following file, and add mysql-native as a dependency it fails to link on Windows 10: import std.stdio; import mysql;

Re: dustmite on dub project

2021-01-26 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 16:04:29 UTC, Steven Schveighoffer wrote: I have a bug report in mysql-native that if you try to create the following file, and add mysql-native as a dependency it fails to link on Windows 10: import std.stdio; import mysql; void main() { writeln("Edit s

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

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 12:40 PM, methonash wrote: My first attempt to solve this problem space used a small Perl program to perform steps 1 through 3, which would then pipe intermediate output to a small Dlang program handling only step #4 using dynamic arrays (no use of AAs) of ubyte[][] with use of count

Re: dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 2:41 PM, Andre Pany wrote: For your specific problem, this issue is related to your dub.json: "configurations": [     {     "excludedSourceFiles": [     "source/mysql/package.d"     ],     "name": "application",     "targetTy

Re: dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 2:59 PM, Steven Schveighoffer wrote: On 1/26/21 2:41 PM, Andre Pany wrote: For your specific problem, this issue is related to your dub.json:  "configurations": [ { "excludedSourceFiles": [ "source/mysql/package.d" ],  

Re: is core Mutex lock "fast"?

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 1:07 PM, ludo wrote: Hi guys, still working on old D1 code, to be updated to D2. At some point the previous dev wrote a FastLock class. The top comment is from the dev himself, not me. My question is after the code. [snip] Is it so that the old Tango's mutex lock was not keepi

Re: dustmite on dub project

2021-01-26 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote: On 1/26/21 2:59 PM, Steven Schveighoffer wrote: On 1/26/21 2:41 PM, Andre Pany wrote: For your specific problem, this issue is related to your dub.json:  "configurations": [ { "excludedSourceFi

Re: dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 3:17 PM, Andre Pany wrote: On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote: Hold on, where do you see this? mysql-native has dub.sdl, and it doesn't have these in there. I executed `dub init sample` and added in the interactive console the dependency `mysq

Re: dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 3:36 PM, Steven Schveighoffer wrote: On 1/26/21 3:17 PM, Andre Pany wrote: On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote: Hold on, where do you see this? mysql-native has dub.sdl, and it doesn't have these in there. I executed `dub init sample` and added

Re: dustmite on dub project

2021-01-26 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 20:36:58 UTC, Steven Schveighoffer wrote: On 1/26/21 3:17 PM, Andre Pany wrote: On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote: Hold on, where do you see this? mysql-native has dub.sdl, and it doesn't have these in there. I executed `d

Re: is core Mutex lock "fast"?

2021-01-26 Thread IGotD- via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 18:07:06 UTC, ludo wrote: Hi guys, still working on old D1 code, to be updated to D2. At some point the previous dev wrote a FastLock class. The top comment is from the dev himself, not me. My question is after the code. --- class FastLock { protected

Re: is core Mutex lock "fast"?

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 3:56 PM, IGotD- wrote: That code isn't thread safe at all (assuming FastLock is used from several threads). lockCount isn't atomic which means the code will not work with several threads.> Also the assignment of the variable owner isn't thread safe. As soon you start to include more

Re: dustmite on dub project

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 3:47 PM, Andre Pany wrote: On Tuesday, 26 January 2021 at 20:36:58 UTC, Steven Schveighoffer wrote: On 1/26/21 3:17 PM, Andre Pany wrote: On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote: Hold on, where do you see this? mysql-native has dub.sdl, and it doesn't

Re: is core Mutex lock "fast"?

2021-01-26 Thread ludo via Digitalmars-d-learn
However, I think this is all moot, druntime is the same as Tango. Moot you mean debatable? Or irrelevant :) Thanks to your explanations, I understand now that the dev tried to imitate a Tango feature with very old D1 code. This is 2005/2009 code And as pointed out by IGotD-, better not to me

Re: is core Mutex lock "fast"?

2021-01-26 Thread IGotD- via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 21:09:34 UTC, Steven Schveighoffer wrote: The only item that is read without being locked is owner. If you change that to an atomic read and write, it should be fine (and is likely fine on x86* without atomics anyway). All the other data is protected by the act

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

2021-01-26 Thread mw via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 17:40:36 UTC, methonash wrote: foreach( i, ref pStr; sortedArr ) { foreach( j, ref cStr; sortedArr[ i + 1 .. $ ] ) { if( indexOf( pStr, cStr ) > -1 ) { // ... } } } Before adding the code excerpt above, the Dlang prog

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

2021-01-26 Thread mw via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 21:55:47 UTC, mw wrote: On Tuesday, 26 January 2021 at 17:40:36 UTC, methonash wrote: foreach( i, ref pStr; sortedArr ) { foreach( j, ref cStr; sortedArr[ i + 1 .. $ ] ) { if( indexOf( pStr, cStr ) > -1 ) { // ... yourInnerOp

Re: is core Mutex lock "fast"?

2021-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/21 4:40 PM, ludo wrote: However, I think this is all moot, druntime is the same as Tango. Moot you mean debatable? Or irrelevant :) I *think* it's irrelevant. The comment makes it sound like it's slightly different than Tango, but for sure reentrant locks are possible with D2 phobos

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

2021-01-26 Thread methonash via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 18:17:31 UTC, H. S. Teoh wrote: Do not do this. Every time you call .array it allocates a new array and copies all its contents over. If this code runs frequently, it will cause a big performance hit, not to mention high GC load. The function you're looking for

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

2021-01-26 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 23:57:43 UTC, methonash wrote: Using AA's may not necessarily improve performance. It depends on what your code does with it. Because AA's require random access to memory, it's not friendly to the CPU cache hierarchy, whereas traversing linear arrays is more ca

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

2021-01-26 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 27, 2021 at 01:28:33AM +, Paul Backus via Digitalmars-d-learn wrote: > On Tuesday, 26 January 2021 at 23:57:43 UTC, methonash wrote: > > > Using AA's may not necessarily improve performance. It depends on > > > what your code does with it. Because AA's require random access > > >