Trying to build a Scheme interpreter in D

Guillaume Piolat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 9 12:30:44 PST 2016


On Tuesday, 8 March 2016 at 18:11:24 UTC, John wrote:
>
> * For this kind of implementation, is the Algebraic type a good 
> choice ? Is a simple union perhaps better ?

You can go with Algebraic. I used to do that in scheme-d. Then I 
switched to a tagged union by hand to avoid a compiler 
regression. Algebraic was OK.


> * I've defined the (recursive) Fibonacci function, for which 
> DMD takes 30sec to calculate Fibonacci(30) and LDC takes 10sec. 
> Is this a reasonable difference between the two compilers?

2x speed difference between DMD and LDC is common.


> * I find it very difficult (actually impossible) to profile 
> code in Mac OS X. There is no output for options -profile. Are 
> there any other profiling/debugging tools for the Mac OS X ? My 
> other ports (C++, Scala) run interpret the same example in 
> under 2sec, so I would like to detect where my bottlenecks are.
>
> Thanks.

You can build with -g and use Instruments.


More information about the Digitalmars-d-learn mailing list