Re: Compiletime Vs Runtime bencmarks

2015-08-18 Thread D_Learner via Digitalmars-d-learn
On Monday, 17 August 2015 at 22:01:32 UTC, John Colvin wrote: On Monday, 17 August 2015 at 17:48:22 UTC, D_Learner wrote: On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen wrote: [...] The surprisingly, the D-profiler gives plausible results:- Algorithm1 2921 int

Re: Compiletime Vs Runtime bencmarks

2015-08-18 Thread D_Learner via Digitalmars-d-learn
On Monday, 17 August 2015 at 22:01:32 UTC, John Colvin wrote: On Monday, 17 August 2015 at 17:48:22 UTC, D_Learner wrote: On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen wrote: [...] The surprisingly, the D-profiler gives plausible results:- Algorithm1 2921 int

Compiletime Vs Runtime bencmarks

2015-08-17 Thread D_Learner via Digitalmars-d-learn
Hello everyone . I need advice on my first D-project . I have uploaded it at :- https://bitbucket.org/mrjohns/matcher/downloads IDEA : Benchmarking of 3 runtime algorithms and comparing them to their compile-time variants. The only difference between these is that for the compile time-ones,

Re: Compiletime Vs Runtime bencmarks

2015-08-17 Thread D_Learner via Digitalmars-d-learn
On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen wrote: On Monday, 17 August 2015 at 14:43:35 UTC, D_Learner wrote: Hello everyone . I need advice on my first D-project . I have uploaded it at :- Current Results for the pattern=GCAGAGAG are as below :- BM_Runtime = 366

Re: Compiletime Vs Runtime bencmarks

2015-08-17 Thread D_Learner via Digitalmars-d-learn
On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen wrote: On Monday, 17 August 2015 at 14:43:35 UTC, D_Learner wrote: Hello everyone . I need advice on my first D-project . I have uploaded it at :- Current Results for the pattern=GCAGAGAG are as below :- BM_Runtime = 366

Re: using memset withing a pure function

2015-08-15 Thread D_Learner via Digitalmars-d-learn
On Saturday, 15 August 2015 at 01:13:02 UTC, Adam D. Ruppe wrote: On Saturday, 15 August 2015 at 01:09:15 UTC, D_Learner wrote: When writting a pure fucntion involving C non pure functions like memcpy() and memset() Those functions are pure already, and marked so in the newest dmd (and I

Re: using memset withing a pure function

2015-08-15 Thread D_Learner via Digitalmars-d-learn
On Saturday, 15 August 2015 at 18:49:15 UTC, anonymous wrote: On Saturday, 15 August 2015 at 18:04:30 UTC, D_Learner wrote: [...] Those two slices have different lengths (when shift != 0). They must have equal lengths, and they must not overlap. [...] Am now sorted. Thanks, your workout

Re: Compiletime Table

2015-08-14 Thread D_Learner via Digitalmars-d-learn
On Friday, 14 August 2015 at 20:48:43 UTC, Adam D. Ruppe wrote: On Friday, 14 August 2015 at 20:40:13 UTC, D_Learner wrote: Perhaps I have to get myself a copy. you should! There's a lot of little tips and tricks in there. Am currently looking at your Dconf2015 talk . My blasphemous talk

Re: Compiletime Table

2015-08-14 Thread D_Learner via Digitalmars-d-learn
On Thursday, 13 August 2015 at 19:26:12 UTC, Adam D. Ruppe wrote: On Thursday, 13 August 2015 at 19:13:55 UTC, D_Learner wrote: [...] It is currently not possible to build an associative array at compile time and keep it as a runtime table due to the implementation. [...] Am aware you

Re: Compiletime Table

2015-08-14 Thread D_Learner via Digitalmars-d-learn
On Thursday, 13 August 2015 at 19:54:18 UTC, anonymous wrote: On Thursday, 13 August 2015 at 19:13:55 UTC, D_Learner wrote: [...] I think you may have some fundamental misunderstandings regarding CTFE, templates, etc. Your code seems to be half-way between a template-based and a

using memset withing a pure function

2015-08-14 Thread D_Learner via Digitalmars-d-learn
When writting a pure fucntion involving C non pure functions like memcpy() and memset() , what could be the way around? Should I re-write these and make them pure? The code am converting is as below :- int ag_cmatch(const string pattern, const string text, int[char] bmBc , int[size]

Re: using memset withing a pure function

2015-08-14 Thread D_Learner via Digitalmars-d-learn
On Saturday, 15 August 2015 at 01:13:02 UTC, Adam D. Ruppe wrote: On Saturday, 15 August 2015 at 01:09:15 UTC, D_Learner wrote: When writting a pure fucntion involving C non pure functions like memcpy() and memset() Those functions are pure already, and marked so in the newest dmd (and I

Re: Structs and compiletime evaluation

2015-08-13 Thread D_Learner via Digitalmars-d-learn
On Thursday, 13 August 2015 at 12:21:44 UTC, Rikki Cattermole wrote: On Thursday, 13 August 2015 at 12:07:48 UTC, D_Learner wrote: I am having this struct :- struct COMPILETIME_BM_PRE { void initialisebmBc(S,C,I,int k)( const S pattern ,ref I[C] bmBc){ static

Structs and compiletime evaluation

2015-08-13 Thread D_Learner via Digitalmars-d-learn
I am having this struct :- struct COMPILETIME_BM_PRE { void initialisebmBc(S,C,I,int k)( const S pattern ,ref I[C] bmBc){ static if ( k ASIZE ){ bmBc[ALPHABET[k]] = size; initialisebmBc!(S,C,I,k+1)( pattern

Compiletime Table

2015-08-13 Thread D_Learner via Digitalmars-d-learn
I was wondering how I could change the code below such the `bmBc` is computed at compile time . The one below works for runtime but it is not ideal since I need to know the `bmBc` table at compile-time . I could appreciate advice on how I could improve on this. import std.conv:to;

Re: Compiletime Table

2015-08-13 Thread D_Learner via Digitalmars-d-learn
On Thursday, 13 August 2015 at 19:26:12 UTC, Adam D. Ruppe wrote: On Thursday, 13 August 2015 at 19:13:55 UTC, D_Learner wrote: I was wondering how I could change the code below such the `bmBc` is computed at compile time . It is currently not possible to build an associative array at