CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
Hi Guys. I recently implemented __ctfeWriteln. Based on that experience I have now implemented another pseudo function called __ctfeTicksMs. That evaluates to a uint representing the number of milliseconds elapsed between the start of dmd and the time of semantic evaluation of this expression.

Re: CompileTime performance measurement

2016-09-03 Thread David Nadlinger via Digitalmars-d
On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: Based on that experience I have now implemented another pseudo function called __ctfeTicksMs. […] Please tell me what you think. Please don't. This makes CTFE indeterministic. To write performance tests, just measure compilation

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 00:08:14 UTC, David Nadlinger wrote: Please don't. This makes CTFE indeterministic. Please elaborate on why this would have a negative impact ? if someone chooses to use a symbol called __ctfeTicksMs they shoud know what they are doing. To write performance te

Re: CompileTime performance measurement

2016-09-03 Thread sarn via Digitalmars-d
On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: I recently implemented __ctfeWriteln. Sounds like pragma msg. How does it compare? https://dlang.org/spec/pragma.html#msg

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 01:44:40 UTC, sarn wrote: On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: I recently implemented __ctfeWriteln. Sounds like pragma msg. How does it compare? https://dlang.org/spec/pragma.html#msg Pragma msg can only print compiletime constants.

Re: CompileTime performance measurement

2016-09-03 Thread sarn via Digitalmars-d
On Sunday, 4 September 2016 at 01:53:21 UTC, Stefan Koch wrote: Pragma msg can only print compiletime constants. While __ctfeWriteln can print state while doing CTFE. Thanks, that makes a lot of sense. Just to check, it prints to standard error, right? Also, the issue of non-deterministic c

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 02:03:49 UTC, sarn wrote: On Sunday, 4 September 2016 at 01:53:21 UTC, Stefan Koch wrote: Pragma msg can only print compiletime constants. While __ctfeWriteln can print state while doing CTFE. Thanks, that makes a lot of sense. Just to check, it prints to stand

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 02:06:55 UTC, Stefan Koch wrote: This works already. Anything placed in a debug {} block will be considered pure regardless. Opps your comment was about the debate. I would say that __ctfeWriteln and __ctfeTicksMs should not work outside of debug.

Re: CompileTime performance measurement

2016-09-03 Thread rikki cattermole via Digitalmars-d
On 04/09/2016 2:08 PM, Stefan Koch wrote: On Sunday, 4 September 2016 at 02:06:55 UTC, Stefan Koch wrote: This works already. Anything placed in a debug {} block will be considered pure regardless. Opps your comment was about the debate. I would say that __ctfeWriteln and __ctfeTicksMs should

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 04:10:29 UTC, rikki cattermole wrote: On 04/09/2016 2:08 PM, Stefan Koch wrote: On Sunday, 4 September 2016 at 02:06:55 UTC, Stefan Koch wrote: This works already. Anything placed in a debug {} block will be considered pure regardless. Opps your comment was abo

Re: CompileTime performance measurement

2016-09-03 Thread rikki cattermole via Digitalmars-d
On 04/09/2016 4:14 PM, Stefan Koch wrote: On Sunday, 4 September 2016 at 04:10:29 UTC, rikki cattermole wrote: On 04/09/2016 2:08 PM, Stefan Koch wrote: On Sunday, 4 September 2016 at 02:06:55 UTC, Stefan Koch wrote: This works already. Anything placed in a debug {} block will be considered pu

Re: CompileTime performance measurement

2016-09-03 Thread Jonathan M Davis via Digitalmars-d
On Sunday, September 04, 2016 16:24:34 rikki cattermole via Digitalmars-d wrote: > On 04/09/2016 4:14 PM, Stefan Koch wrote: > > On Sunday, 4 September 2016 at 04:10:29 UTC, rikki cattermole wrote: > >> On 04/09/2016 2:08 PM, Stefan Koch wrote: > >>> On Sunday, 4 September 2016 at 02:06:55 UTC, St

Re: CompileTime performance measurement

2016-09-03 Thread rikki cattermole via Digitalmars-d
On 04/09/2016 4:31 PM, Jonathan M Davis via Digitalmars-d wrote: On Sunday, September 04, 2016 16:24:34 rikki cattermole via Digitalmars-d wrote: On 04/09/2016 4:14 PM, Stefan Koch wrote: On Sunday, 4 September 2016 at 04:10:29 UTC, rikki cattermole wrote: On 04/09/2016 2:08 PM, Stefan Koch wr

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 04:35:15 UTC, rikki cattermole wrote: void writeln(T...)(T args) { if (__ctfe){ debug { __ctfeWriteln(args); } } else { // ... current implementation } } That will not work. The signature is void __ctfeWriteln(const string s)

Re: CompileTime performance measurement

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 04:31:09 UTC, Jonathan M Davis wrote: He didn't say that it _couldn't_ be done. He said that it _shouldn't_ be done. - Jonathan M Davis Yes exactly.

Re: CompileTime performance measurement

2016-09-04 Thread Andrei Alexandrescu via Digitalmars-d
On 9/4/16 6:10 AM, rikki cattermole wrote: On 04/09/2016 2:08 PM, Stefan Koch wrote: On Sunday, 4 September 2016 at 02:06:55 UTC, Stefan Koch wrote: This works already. Anything placed in a debug {} block will be considered pure regardless. Opps your comment was about the debate. I would say

Re: CompileTime performance measurement

2016-09-04 Thread Andrei Alexandrescu via Digitalmars-d
On 9/4/16 6:14 AM, Stefan Koch wrote: writeln and __ctfeWriteln are to be regarded as completely different things. __ctfeWriteln is a debugging tool only! It should not be used in any production code. Well I'm not sure how that would be reasonably enforced. -- Andrei

Re: CompileTime performance measurement

2016-09-04 Thread Stefan Koch via Digitalmars-d
On Sunday, 4 September 2016 at 12:38:05 UTC, Andrei Alexandrescu wrote: On 9/4/16 6:14 AM, Stefan Koch wrote: writeln and __ctfeWriteln are to be regarded as completely different things. __ctfeWriteln is a debugging tool only! It should not be used in any production code. Well I'm not sure ho

Re: CompileTime performance measurement

2016-09-05 Thread timepp via Digitalmars-d
On Sunday, 4 September 2016 at 04:24:34 UTC, rikki cattermole wrote: void writeln(T...)(T args) { if (__ctfe){ debug { __ctfeWriteln(args); } } else { // ... current implementation } } Are you sur

Re: CompileTime performance measurement

2016-09-06 Thread Martin Tschierschke via Digitalmars-d
On Sunday, 4 September 2016 at 19:36:16 UTC, Stefan Koch wrote: On Sunday, 4 September 2016 at 12:38:05 UTC, Andrei Alexandrescu wrote: On 9/4/16 6:14 AM, Stefan Koch wrote: writeln and __ctfeWriteln are to be regarded as completely different things. __ctfeWriteln is a debugging tool only! It

Re: CompileTime performance measurement

2016-09-06 Thread Martin Nowak via Digitalmars-d
On Sunday, 4 September 2016 at 00:08:14 UTC, David Nadlinger wrote: Please don't. This makes CTFE indeterministic. Well we already have __TIMESTAMP__, though I think it doesn't change during compilation.

Re: CompileTime performance measurement

2016-09-06 Thread Martin Nowak via Digitalmars-d
On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: I recently implemented __ctfeWriteln. Nice, is it only for your interpreter or can we move https://trello.com/c/6nU0lbl2/24-ctfewrite to done? I think __ctfeWrite would be a better primitive. And we could actually consider to sp

Re: CompileTime performance measurement

2016-09-06 Thread Martin Nowak via Digitalmars-d
On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: Hi Guys. I recently implemented __ctfeWriteln. Based on that experience I have now implemented another pseudo function called __ctfeTicksMs. That evaluates to a uint representing the number of milliseconds elapsed between the star

Re: CompileTime performance measurement

2016-09-06 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, September 06, 2016 10:46:11 Martin Nowak via Digitalmars-d wrote: > On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: > > Hi Guys. > > > > I recently implemented __ctfeWriteln. > > Based on that experience I have now implemented another pseudo > > function called __ctfeTic

Re: CompileTime performance measurement

2016-09-06 Thread Stefan Koch via Digitalmars-d
On Tuesday, 6 September 2016 at 10:42:00 UTC, Martin Nowak wrote: On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: I recently implemented __ctfeWriteln. Nice, is it only for your interpreter or can we move https://trello.com/c/6nU0lbl2/24-ctfewrite to done? I think __ctfeWrite

Re: CompileTime performance measurement

2016-09-06 Thread Rory McGuire via Digitalmars-d
On Tue, Sep 6, 2016 at 7:42 PM, Stefan Koch via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Tuesday, 6 September 2016 at 10:42:00 UTC, Martin Nowak wrote: > >> On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: >> >>> I recently implemented __ctfeWriteln. >>> >> >> Nice,

Re: CompileTime performance measurement

2016-09-07 Thread Stefan Koch via Digitalmars-d
On Wednesday, 7 September 2016 at 06:49:09 UTC, Rory McGuire wrote: Seriously Stefan, you make my day! My libraries will be so much easier to write! I am glad the time was not wasted. Let's hope it gets merged :)

Re: CompileTime performance measurement

2016-09-08 Thread safety0ff via Digitalmars-d
On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: ... I have now implemented another pseudo function called __ctfeTicksMs. [Snip] This does allow meaningful compiletime performance tests to be written. spanning both CTFE and template-incitations timeings. Please tell me what

Re: CompileTime performance measurement

2016-09-08 Thread Stefan Koch via Digitalmars-d
On Thursday, 8 September 2016 at 16:52:47 UTC, safety0ff wrote: On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: ... I have now implemented another pseudo function called __ctfeTicksMs. [Snip] This does allow meaningful compiletime performance tests to be written. spanning b

Re: CompileTime performance measurement

2016-09-08 Thread safety0ff via Digitalmars-d
On Thursday, 8 September 2016 at 17:03:30 UTC, Stefan Koch wrote: I thought of the same thing a while back. However I have had the time to decipher the gprof data-format yet. Is there another profile-format for decent visualization tools exist ? I was just using that as an example of what we

Re: CompileTime performance measurement

2016-09-08 Thread Stefan Koch via Digitalmars-d
On Thursday, 8 September 2016 at 17:15:54 UTC, safety0ff wrote: On Thursday, 8 September 2016 at 17:03:30 UTC, Stefan Koch wrote: I thought of the same thing a while back. However I have had the time to decipher the gprof data-format yet. Is there another profile-format for decent visualizatio

Re: CompileTime performance measurement

2016-09-09 Thread Marco Leise via Digitalmars-d
Am Tue, 06 Sep 2016 05:02:54 + schrieb timepp : > On Sunday, 4 September 2016 at 04:24:34 UTC, rikki cattermole > wrote: > > void writeln(T...)(T args) { > > if (__ctfe){ > > debug { > > __ctfeWriteln(args); > > } > > } else { > >