On Thu, 2006-12-07 at 12:19 +0100, Ćukasz Lew wrote:
> Big thanks from me for that. :)
>
> Have You tried to use C and D together?
I can now say I've tried, and it's completely trivial. I have a
routine that returns processor time in seconds for timing purposes and I
decided to see if I could link it in to the D program. All it took to
see this routine after linking it in was a declaration telling the D
program that it used C calling conventions:
extern (C) double seconds();
>From the D page on the subject:
"C functions can be called directly from D. There is no need for
wrapper functions, argument swizzling, and the C functions do
not need to be put into a separate DLL."
The author also says this:
"It would be senseless to attempt to port to D or write D
wrappers for the vast array of C APIs available. How much easier
it is to just call them directly."
- Don
> BTW
> D is geting more popular recently.
> http://www.tiobe.com/tpci.htm
>
> Lukasz
>
> On 12/7/06, Don Dailey <[EMAIL PROTECTED]> wrote:
> > Ok, here is my report on the D language for Go:
> >
> > The gdc (gnu D compiler) compiler for D is a bit better if you tune the
> > options and there are a few more options to tinker with. It actually
> > helped me find a bug (it is more anal) that probably made the other
> > tests I reported invalid. The D program is now only 1.47 times slower
> > than the equivalent C program, and even the digital mars compiler is ok
> > but not quite as fast.
> >
> > It's still too slow for my taste but I'm still trying to find out if I'm
> > doing all I can do. It's possible there may be language idioms I should
> > be using or better ways to do things in D that I don't know about.
> >
> > I do really like it - It's c++ without all the warts and lots of
> > improvements. There are versions for windows, unix, Macs. I may
> > start using it for other things - but probably not computer GO unless I
> > can get it closer to C speed.
> >
> > Here are the numbers:
> >
> > The equivalent C version (after I took out some optimizations) is
> > doing 13,745.70 games per second on an old pentium 4.
> >
> > My best D version is doing 9,327.49 games per second.
> >
> > The most optimized C version is doing 16,398.82 games per second.
> > These same extra optimizations could be applied to the D version and I
> > think it would help as much or even more - I manually unrolled some
> > loops to save some branching and memory indirection.
> >
> > Dave Dyer think the extra 50% running time isn't that important but I
> > know from my own scalability experiments that Lazarus running at this
> > 1.47 handicap would be noticeably weaker on CGOS. I might accept the
> > slowdown if it were more like 1.25, for the extra convenience. This
> > language is very good at helping you with bugs - checking array bounds
> > problems etc.
> >
> >
> > - Don
> >
> >
> >
> >
> > On Wed, 2006-12-06 at 22:11 -0500, Don Dailey wrote:
> > > On Wed, 2006-12-06 at 17:54 -0800, steve uurtamo wrote:
> > > > > I'll see if I can figure out what options turn on
> > > > > all the speed now ...
> > > >
> > > > C
> > > >
> > > > :)
> > > >
> > > > s.
> > >
> > > You might be right. I finally found the useful switches which were "-O
> > > -release -inline"
> > > and it did speed things up, but I'm still almost 2.4 times slower than
> > > the equivalent C version with the best optimizations.
> > >
> > > That's way too much for me - pity I would really enjoy working in this
> > > language.
> > >
> > > One more thing to try - there is a gcc version I will try.
> > >
> > > I wonder if the object oriented stuff hurts it? Does anyone know if
> > > that poses a lot of extra overhead in say c++? Almost the whole
> > > program is contained and working from inside the class I defined to
> > > encapsulate most of the functionality.
> > >
> > >
> > > - Don
> > >
> > >
> > >
> >
> > _______________________________________________
> > computer-go mailing list
> > [email protected]
> > http://www.computer-go.org/mailman/listinfo/computer-go/
> >
_______________________________________________
computer-go mailing list
[email protected]
http://www.computer-go.org/mailman/listinfo/computer-go/