Re: How to debug long-lived D program memory usage?

2019-04-17 Thread Julian via Digitalmars-d-learn
On Wednesday, 17 April 2019 at 16:27:02 UTC, Adam D. Ruppe wrote: D programs are a vital part of my home computer infrastructure. I run some 60 D processes at almost any time and have recently been running out of memory. Each individual process eats ~30-100 MB, but that times 60 =

Re: Efficient enum array keys?

2019-04-11 Thread Julian via Digitalmars-d-learn
On Thursday, 11 April 2019 at 06:45:23 UTC, Basile B. wrote: On Thursday, 11 April 2019 at 06:20:05 UTC, Julian wrote: Is there a nicer way to have enum array keys in D? No. I've myself written my own EnumIndexedArray [1] type. It's pretty simple. Just a couple of operator overload to

Efficient enum array keys?

2019-04-11 Thread Julian via Digitalmars-d-learn
Hello, When reading through the following D blog post, I noticed in the feature chart that D had "Arrays beginning at arbitrary indices" as a +1 feature, the same as in Ada. https://dlang.org/blog/2018/06/20/how-an-engineering-company-chose-to-migrate-to-d/ That surprised me, and from the

Re: How to compile and link simple application?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 19:43:11 UTC, Julian wrote: On Monday, 8 April 2019 at 19:29:33 UTC, 4544fa8d wrote: It's really not possible to call functions in modules like in any other languages? :S What some other languages do is collect all of those calls into an implicit function that's

Re: How to compile and link simple application?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 19:29:33 UTC, 4544fa8d wrote: It's really not possible to call functions in modules like in any other languages? :S What some other languages do is collect all of those calls into an implicit function that's called before main(). What D does is run that code at

Re: How to compile and link simple application?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 18:54:10 UTC, Julian wrote: @property string root_dir() { static string cache; static bool isInit = false; if (!isInit) { isInit = true; cache = dirName(thisExePath()); } return cache; } Shorter: string

Re: How to compile and link simple application?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 18:47:42 UTC, 4544fa8d wrote: On Monday, 8 April 2019 at 18:41:00 UTC, Adam D. Ruppe wrote: Did you put your code inside a main() function? I want to make constant with path to directory containing executable. This line is above main():

Re: How to compile and link simple application?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 18:38:58 UTC, 4544fa8d wrote: Hello, I have "hello world" application. I imported std.file, executed thisExePath() and now I have this error: dmd -m64 -of=../../bin/manager -release ./src/manager.d

Re: Iterate/sort associative array by value?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 17:13:32 UTC, Seb wrote: On Monday, 8 April 2019 at 08:31:33 UTC, Dennis wrote: On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote: Why does DMD not give a hint, that an import from the standard lib might be missing? I find these explicit import

Re: Iterate/sort associative array by value?

2019-04-08 Thread Julian via Digitalmars-d-learn
On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote: On 2019-04-07 19:28:02 +, Dennis said: Did you import it? import std.algorithm; :-/ of course not... Why does DMD not give a hint, that an import from the standard lib might be missing? It does do this, so the question

Re: Poor regex performance?

2019-04-04 Thread Julian via Digitalmars-d-learn
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole wrote: If you need performance use ldc not dmd (assumed). LLVM has many factors better code optimizes than dmd does. Thanks! I already had dmd installed from a brief look at D a long time ago, so I missed the details at

Poor regex performance?

2019-04-04 Thread Julian via Digitalmars-d-learn
The following code, that just runs a regex against a large exim log to report on top senders, is 140 times slower than similar C code using PCRE, when compiled with just -O. With a bunch of other flags I got it down to only 13x slower than C code that's using libc regcomp/regexec. import