Re: Simple performance question from a newcomer

2016-02-21 Thread Kapps via Digitalmars-d-learn
On Monday, 22 February 2016 at 07:10:23 UTC, Kapps wrote: If you do want to test the differences between the range approach and the loop approach, something like: auto sumtest4(Range)(Range range) @safe pure { return range.reduce!((a, b) => a + b); } is a more fair comparison. I get resu

Re: Simple performance question from a newcomer

2016-02-21 Thread Kapps via Digitalmars-d-learn
If you do want to test the differences between the range approach and the loop approach, something like: auto sumtest4(Range)(Range range) @safe pure { return range.reduce!((a, b) => a + b); } is a more fair comparison. I get results within 15% of sumtest2 with this using dmd. I think wi

Re: vk.xml

2016-02-21 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 21 February 2016 at 15:18:44 UTC, ZombineDev wrote: On Sunday, 21 February 2016 at 12:52:33 UTC, Nicholas Wilson wrote: So I was going through the vulcan spec to try to create a better D bindings for it. (pointer /len pairs to arrays adhering to D naming conventions and prettying up

Re: Enforcing checks for return code

2016-02-21 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 18 February 2016 at 10:46:03 UTC, Marc Schütz wrote: On Thursday, 18 February 2016 at 07:21:05 UTC, Chris Katko wrote: [...] As Jonathan said, there's no such built-in feature, and exception are preferred over return codes. However, you can implement such a check at run time:

Re: immutable class can't override opEquals, workaround?

2016-02-21 Thread SimonN via Digitalmars-d-learn
On Sunday, 21 February 2016 at 07:58:42 UTC, Jonathan M Davis wrote: opEquals still works with const and immutable if it's legal to use a class as the key in an AA, it's a bug have a working version of the PR hasn't even been looked at yet from what I can tell, and it's the simplest of the bit

Re: compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread anonymous via Digitalmars-d-learn
On 21.02.2016 22:51, kraxli wrote: On Sunday, 21 February 2016 at 21:35:55 UTC, anonymous wrote: [...] a) do it the linker way: `dmd -L-L~/.dub/packages/consoled-1.0.0/ -L-lconsoled ...`, or b) do it the dmd way: `dmd ~/.dub/packages/consoled-1.0.0/libconsoled.a ...`. b) works! :-) Many thank

Re: Template this parameter in constructor

2016-02-21 Thread Ali Çehreli via Digitalmars-d-learn
On 02/21/2016 01:48 PM, Steven Schveighoffer wrote: > So it follows that the template this type will be the next derived > constructor (or the type itself if that is the most derived type), I've just checked: Adding a C4 to the interitance chain (and constructing a C4) confirms that to be the c

Re: compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 21 February 2016 at 21:51:27 UTC, kraxli wrote: a) doesn't work, I need to search for more information on linking as I would like to understand these kind of basics in D :-). The books I consulted so far (Learn D and D cookbook) did not help me to understand the linking so far ...

Re: compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread kraxli via Digitalmars-d-learn
On Sunday, 21 February 2016 at 21:35:55 UTC, anonymous wrote: On Sunday, 21 February 2016 at 21:21:30 UTC, kraxli wrote: Thanks for coming back on that! The problem is the consoled-package which has the library: ~/.dub/packages/consoled-1.0.0/libconsoled.a So I link it (or aim to do it ;-) ) b

Re: Template this parameter in constructor

2016-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/21/16 11:48 AM, Vlad Leberstein wrote: Hi! I'm struggling to use "Template This Parameters" feature(as described in https://dlang.org/spec/template.html#TemplateThisParameter) in class constructor. But it's usage isn't documented very clearly and I'm not even sure if it's supposed to work th

Re: compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread anonymous via Digitalmars-d-learn
On Sunday, 21 February 2016 at 21:21:30 UTC, kraxli wrote: Thanks for coming back on that! The problem is the consoled-package which has the library: ~/.dub/packages/consoled-1.0.0/libconsoled.a So I link it (or aim to do it ;-) ) but dmd cannot find it: $ dmd -I~/.dub/packages/consoled-1.0.0/

Re: compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread kraxli via Digitalmars-d-learn
On Sunday, 21 February 2016 at 20:50:11 UTC, anonymous wrote: On Sunday, 21 February 2016 at 20:04:34 UTC, kraxli wrote: What is going on here and what is the difference between dmd and rdmd? dmd compiles the modules that you specify on the command line. By default, it then links an executabl

Re: compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread anonymous via Digitalmars-d-learn
On Sunday, 21 February 2016 at 20:04:34 UTC, kraxli wrote: What is going on here and what is the difference between dmd and rdmd? dmd compiles the modules that you specify on the command line. By default, it then links an executable from the generated object files. The linking can only work w

compilation issues (dmd, rdmd, ldc2)

2016-02-21 Thread kraxli via Digitalmars-d-learn
I have problems with compiling a very simple program which loads a couple of modules/functions (which I would like to use later on). rdmd -I~/.dub/packages/consoled-1.0.0/source/ appX.d runs great :-) and also dub runs works. But dmd only returns: ´´´ $ dmd -I~/.dub/packages/consoled-1.0.0/

Re: ldc application unable to start

2016-02-21 Thread jmh530 via Digitalmars-d-learn
On Sunday, 21 February 2016 at 17:54:30 UTC, Rainer Schuetze wrote: This error code is often caused by a DLL being compiled for the wrong architecture, so I guess that you have some 32-bit DLL in your original folder that is found instead of the 64-bit DLL. That pointed me in the direction o

Re: ldc application unable to start

2016-02-21 Thread Rainer Schuetze via Digitalmars-d-learn
On 21.02.2016 18:11, jmh530 wrote: The application was unable to start correctly (0xc7b). Click OK to close the application. This error code is often caused by a DLL being compiled for the wrong architecture, so I guess that you have some 32-bit DLL in your original folder that is found

Re: Get memory usage report from GC

2016-02-21 Thread Rainer Schuetze via Digitalmars-d-learn
On 20.02.2016 07:22, tcak wrote: On Saturday, 20 February 2016 at 05:55:26 UTC, Jon D wrote: On Saturday, 20 February 2016 at 05:34:01 UTC, tcak wrote: On Saturday, 20 February 2016 at 05:33:00 UTC, tcak wrote: Is there any way (I checked core.memory already) to collect report about memory u

ldc application unable to start

2016-02-21 Thread jmh530 via Digitalmars-d-learn
I'm playing around with ldc on Windows 64bit. I'm able to compile some simple stuff, but I'm having an issue with something I compile giving an error: The application was unable to start correctly (0xc7b). Click OK to close the application. This is effectively the ldc2 command I had run

Template this parameter in constructor

2016-02-21 Thread Vlad Leberstein via Digitalmars-d-learn
Hi! I'm struggling to use "Template This Parameters" feature(as described in https://dlang.org/spec/template.html#TemplateThisParameter) in class constructor. But it's usage isn't documented very clearly and I'm not even sure if it's supposed to work this way. Consider the following example:

Re: Simple performance question from a newcomer

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 16:36:22 UTC, ZombineDev wrote: On Sunday, 21 February 2016 at 16:29:26 UTC, ZombineDev wrote: ... And if I use the Kahan algorithm: 106 ms 36 ms 31 ms The second two results are probably larger due to noise. I did some more testing and clearly the larger times f

Re: Simple performance question from a newcomer

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 16:29:26 UTC, ZombineDev wrote: ... And if I use the Kahan algorithm: 106 ms 36 ms 31 ms The second two results are probably larger due to noise. I did some more testing and clearly the larger times for N=1000 were just noise: [LDC Kahan N=1000] 106 ms 36 ms 31

Re: Simple performance question from a newcomer

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote: I've been vaguely aware of D for many years, but the recent addition of std.experimental.ndslice finally inspired me to give it a try, since my main expertise lies in the domain of scientific computing and I primarily use Python/Jul

Re: Simple performance question from a newcomer

2016-02-21 Thread bachmeier via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote: I had heard while reading up on the language that in D explicit loops are generally frowned upon and not necessary for the usual performance reasons. First, a minor point, the D community is usually pretty careful not to frown on

Re: Simple performance question from a newcomer

2016-02-21 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote: Now, seeing as how my experience writing D is literally a few hours, is there anything I did blatantly wrong? Did I miss any optimizations? Most importantly, can the elegant operator chaining style be generally made as fast as the e

Re: Simple performance question from a newcomer

2016-02-21 Thread Daniel Kozak via Digitalmars-d-learn
So I guess pairwise summation is one to blame here. Dne 21.2.2016 v 16:56 Daniel Kozak napsal(a): You can use -profile to see what is causing it. Num TreeFuncPer CallsTimeTimeCall 2300 550799875 550243765 23 pure nothrow

Re: Simple performance question from a newcomer

2016-02-21 Thread Daniel Kozak via Digitalmars-d-learn
You can use -profile to see what is causing it. Num TreeFuncPer CallsTimeTimeCall 2300 550799875 550243765 23 pure nothrow @nogc @safe double std.algorithm.iteration.sumPairwise!(double, std.experimental.ndslice.slice.Sl

Re: 111

2016-02-21 Thread Lisa via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:03:56 UTC, Ivan Kazmenko wrote: On Sunday, 21 February 2016 at 12:35:31 UTC, Lisa wrote: ... Is there smth wrong again? Yes. As a programmer, most of the time, you will have to try your programs by yourself before you consider them correct. Now, run a comp

Re: vk.xml

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 12:52:33 UTC, Nicholas Wilson wrote: So I was going through the vulcan spec to try to create a better D bindings for it. (pointer /len pairs to arrays adhering to D naming conventions and prettying up the *Create functions functions like vkResult *Create( arg ,&ar

Re: Simple performance question from a newcomer

2016-02-21 Thread jmh530 via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote: Now, seeing as how my experience writing D is literally a few hours, is there anything I did blatantly wrong? Did I miss any optimizations? Most importantly, can the elegant operator chaining style be generally made as fast as the

Simple performance question from a newcomer

2016-02-21 Thread dextorious via Digitalmars-d-learn
I've been vaguely aware of D for many years, but the recent addition of std.experimental.ndslice finally inspired me to give it a try, since my main expertise lies in the domain of scientific computing and I primarily use Python/Julia/C++, where multidimensional arrays can be handled with a gre

Re: 111

2016-02-21 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 21 February 2016 at 12:35:31 UTC, Lisa wrote: ... Is there smth wrong again? Yes. As a programmer, most of the time, you will have to try your programs by yourself before you consider them correct. Now, run a compiler, and it complains: - main.d(20): Error: cannot return non-

vk.xml

2016-02-21 Thread Nicholas Wilson via Digitalmars-d-learn
So I was going through the vulcan spec to try to create a better D bindings for it. (pointer /len pairs to arrays adhering to D naming conventions and prettying up the *Create functions functions like vkResult *Create( arg ,&arg, retptr) to a fancy throw on misuse struct with constructors and t

Re: 111

2016-02-21 Thread Lisa via Digitalmars-d-learn
On Saturday, 20 February 2016 at 12:59:58 UTC, Ivan Kazmenko wrote: On Saturday, 20 February 2016 at 04:15:50 UTC, Lisa wrote: module main; import std.stdio; import std.math; int main() { int A, B, C; writef("A = "); readf("%lf", %A); writef("B = "); re

Re: Status icon on Linux

2016-02-21 Thread Mike Wey via Digitalmars-d-learn
On 02/20/2016 06:32 PM, Gerald wrote: On Saturday, 20 February 2016 at 11:36:11 UTC, Mike Wey wrote: The documentation states we should use notifications, that means i'll probably need to add libnotify bindings to GtkD. Though sending notifications using DBus is also possible. (https://developer

Re: immutable class can't override opEquals, workaround?

2016-02-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 21, 2016 04:25:59 SimonN via Digitalmars-d-learn wrote: > Hi, > > immutable class A { > int i; > this(int arg) { i = arg; } > override bool opEquals(Object rhsObj) > { > auto rhs = cast (immutable(A)) rhsObj; > r