January 20, 2005
"Kris" <Kris_member@pathlink.com> wrote in message news:csmtcs$sao$1@digitaldaemon.com...
> In article <csmgiq$bdr$1@digitaldaemon.com>, Walter says...
> >
> >DMDScript in D provides a shakedown cruise for the D programming
language,
> >being a substantial, professional quality application, proving that D has what it takes to outperform C++ in both programmer productivity and resulting application efficiency.
>
> Walter,
>
> Did you intend to imply that all past efforts, written thus far in D, did
not
> provide a "shakedown cruise"? Or are somehow not subtantial, professional-quality applications? Or did not already prove that D has
what it
> takes ... ?
>
> It's interesting to see you do something like this, but I'm more than a
little
> surprised at the language utilized here -- it can rather easily be
interpreted
> as "this is the first time anything of value has been done with D" ...
followed
> by lots of big exclamation marks
>
> I sure hope you didn't intent it to come off in this manner. There again,
I
> suspect the vast majority of this newsgroup already /knows/ all of these
things
> about D. What gives?

I'm sorry, it didn't occur to me that it would be interpreted that way. I meant it as a comparison with C++ using a substantial app written in both C++ and D. There are other substantial apps in D, but as far as I know, they aren't directly comparable to C++ apps, so a comparison is apples and oranges. DMDScript is a translation from a C++ product, so it enabled me to do a side-by-side comparison of the two languages using substantial code I know intimately, something I haven't been able to do so far. I'm pretty thrilled with the results, as D came off a winner by just about every measure. My enthusiasm got the better of me when I wrote that piece!


January 20, 2005
Walter wrote:

> Ak. I always goof up something. I've attached a corrected linux.mak.

Yes, even seems to work out of the zipfile now...

> BTW, errmsgs.d is created by textgen.d.

I know that now. The rule for "ds" had no idea ;-)

> ds : errmsgs.d testscript.o libdmdscript.a linux.mak

The "minimal test suite" suite.ds fails, by the way ?

> Error: assert() line 1407


I have built a SRPM with a .spec file, for RPM building:

http://www.algonet.se/~afb/d/dmdscript-1.03-1.nosrc.rpm
http://www.algonet.se/~afb/d/dmdscript.spec

RPMS (FC1)
172K    dmdscript-1.03-1.i686.rpm
292K    dmdscript-devel-1.03-1.i686.rpm

--anders
January 20, 2005
"Anders F Björklund" <afb@algonet.se> wrote in message news:csmvth$ul0$1@digitaldaemon.com...
> The "minimal test suite" suite.ds fails, by the way ?
>
> > Error: assert() line 1407

Hmm. It works on my machine. It might be because you're in a different timezone.


January 20, 2005
Yes, I was also a little confused by that paragraph.  Good to see the meaning clarified.

Kris wrote:
> In article <csmgiq$bdr$1@digitaldaemon.com>, Walter says...
> 
>>DMDScript in D provides a shakedown cruise for the D programming language,
>>being a substantial, professional quality application, proving that D has
>>what it takes to outperform C++ in both programmer productivity and
>>resulting application efficiency.
> 
> 
> Walter, 
> 
> Did you intend to imply that all past efforts, written thus far in D, did not
> provide a "shakedown cruise"? Or are somehow not subtantial,
> professional-quality applications? Or did not already prove that D has what it
> takes ... ?
> 
> It's interesting to see you do something like this, but I'm more than a little
> surprised at the language utilized here -- it can rather easily be interpreted
> as "this is the first time anything of value has been done with D" ... followed
> by lots of big exclamation marks
> 
> I sure hope you didn't intent it to come off in this manner. There again, I
> suspect the vast majority of this newsgroup already /knows/ all of these things
> about D. What gives?
> 
> 
January 20, 2005
In article <csmvf7$ujs$1@digitaldaemon.com>, Walter says...
I'm sorry, it didn't occur to me that it would be interpreted that way. I
>meant it as a comparison with C++ using a substantial app written in both C++ and D. There are other substantial apps in D, but as far as I know, they aren't directly comparable to C++ apps, so a comparison is apples and oranges.

OK; although there are comparable apps (such as HTTP-servers, Servlet-style engines, and others) that have been around for quite some time, and which bathe D in a suitably favourable light. Those could be considered apples-to-apples, but perhaps as Golden-Delicious vs Orange-Pippins?

BTW: did you make extensive use of class-Interfaces, method-overloading, or anything related? How about DLLs? If so, you'd have undoubtably run into the same problems that those of us writing large quantities of D have taken issue with :-)

The point is that one rarely runs into such problems until working with a project of significance, designed with some of that professional-quality you speak of.

I'd like to encourage you to attempt building a framework that cannot be statically linked. Perhaps then you'd be a bit more sympathetic to all those requests regarding DLLs and a single GC instance :-)

- Kris


January 20, 2005
Do you have any specific explanation for the speedup?

I believe very well, that D code is more compact, more portable and slightly more efficient, but a threefold speedup seems more like you did some clever optimizations in D that were not backported to the C++ version.

(Nothing against D - I just love playing the devil's advocate... :-) )


Walter wrote:

> At last, D now has its own scripting language, DMDScript! DMDScript is an implementation of the ECMA 262 scripting language (also known as javascript). The engine is written 100% in D, comes with full source code, and linkable libraries for Windows and linux. This means that any D application for which adding on scripting capability makes sense can now do it.
> 
> If you examine the D source for DMDScript, some remarkable characteristics are apparent. The first is how portable it is - almost zero versioning between Windows and linux builds. Next is how compact it is. Did you ever think a full, professional ECMA scripting engine could be expressed in so few lines of code? So what about performance, you might say? Doesn't compact code come at a price of slow performance?
> 
> Try the benchmarks yourself (sieve.ds and sieve.html), comparing DMDScript
> (by running sieve.ds) with the scripting engine in your browser (by
> loading sieve.html into your browser). Post the numbers here!
> 
> Isn't D, with all its compactness and expressiveness, necessarilly slower than C++? DMDScript in D is a translation from DMDScript in C++. The D version runs faster!
> 
> DMDScript in D provides a shakedown cruise for the D programming language, being a substantial, professional quality application, proving that D has what it takes to outperform C++ in both programmer productivity and resulting application efficiency.
> 
> DMDScript in D comes with open source under the GPL license. Licenses are available for purchase from Digital Mars for use in commercial, closed source applications.
> 
> -Walter
> www.digitalmars.com/dscript/ DMDScript scripting engine in D!

January 20, 2005
Walter wrote:

>>The "minimal test suite" suite.ds fails, by the way ?
>>>Error: assert() line 1407
> 
> Hmm. It works on my machine. It might be because you're in a different
> timezone.

Could be. The next time test, a few lines down, failed too.

--anders

PS. Different processor, different OS, different timezone...
    http://isbn.nu/cgi-bin/isbnbookcover?isbn=0836218620 :-)
January 20, 2005
"Norbert Nemec" <Norbert@Nemec-online.de> wrote in message news:csnr94$224l$1@digitaldaemon.com...
> Do you have any specific explanation for the speedup?

The 3x speedup is over Microsoft's Jscript. Since I have never seen their implementation, I have no idea why it is so slow. The DMDScript in D is slightly faster (10%) than my own C++ version. While any particular statement of D code isn't faster than C++, the much simpler nature of the D version enabled me to experiment easilly with changes in the data structures to find a more optimal combination. The C++ was just more brittle and I was reluctant to make changes.

(D code in general is faster than C++ because D is garbage collected. DMDScript in C++ used a garbage collector, though, so the D version didn't have that advantage.) I spent many weeks tuning the C++ version for speed, and resorted to many dirty tricks that would horrify you <g>. The D version uses only one, a customized and inlined version of the associatve array lookup.

D also has a fantastic and trivial to use profiler - just throw -gt on the command line - that I used extensively to tune it. Trying to tune a program without a profiler is like extracting a bullet from a brain without x-rays.

> I believe very well, that D code is more compact, more portable and
slightly
> more efficient, but a threefold speedup seems more like you did some
clever
> optimizations in D that were not backported to the C++ version.
>
> (Nothing against D - I just love playing the devil's advocate... :-) )

LOL. I get regularly accused of "sabotaging" or "crippling" DMC++, and deliberately writing bad C++ code, in order to make D look good, because everyone knows that C++ can't be beat for speed.

Or maybe the conventional wisdom is wrong.


January 20, 2005
Walter wrote:
<snip>
> Try the benchmarks yourself (sieve.ds and sieve.html), comparing DMDScript (by running sieve.ds) with the scripting engine in your browser (by loading sieve.html into your browser). Post the numbers here!

I suppose we should benchmark different browsers, and see how many of them come close to DMDScript.

> Isn't D, with all its compactness and expressiveness, necessarilly slower than C++?  DMDScript in D is a translation from DMDScript in C++. The D
> version runs faster!
<snip>

Yes, maybe scripting language implementations tend to benefit considerably from GC.

FTM, what does the second D in DMDScript stand for?

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
January 20, 2005
Haven't tried 'ds' yet, but using Microsoft's cscript I get a result of ~578.

Using the html IE I got something similar, but to prevent IE's downloading/html threads from getting CPU, I changed the html file (see below) so that it waits 1 second (for the HTML to be loaded and parsed) before it runs the test and then I get ~297 (tested several times).

I don't really trust these results. Does IE do some pre-parsing to byte-code?

No result from within FireFox, even after commenting out the line with ScriptEngine(). Just keeps running and running....

Lionello.

-------------------------------------------
<HTML>
<BODY onload="timer=setTimeout('doit()',1000);">
<SCRIPT LANGUAGE="JavaScript">

document.write(navigator.appName);
 var b = navigator.appName
 if (b=="Netscape") this.b = "ns"
 else if (b=="Microsoft Internet Explorer") this.b = "ie"
 else this.b = b
document.writeln(" " + b);

document.write("<br> ScriptEngine " + ScriptEngine() + " Build " + ScriptEngineBuildVersion() + "<br>");

document.write("<h2>Eratosthenes Sieve prime number calculation</h2><br>");

function doit()
{
//.............
}

</SCRIPT>
</BODY>
</HTML>