www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Announcing DMDScript for D!

reply "Walter" <newshound digitalmars.com> writes:
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!
Jan 19 2005
next sibling parent "Charles" <no email.com> writes:
 www.digitalmars.com/dscript/ DMDScript scripting engine in D!
Server down ? Charlie "Walter" <newshound digitalmars.com> wrote in message news:csmgiq$bdr$1 digitaldaemon.com...
 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!
Jan 19 2005
prev sibling next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter wrote:

 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.
I didn't get too far: make -f linux.mak make: *** No rule to make target `testscript.o', needed by `ds'. Stop. So I added a rule for it: dmd -c -O -release testscript.d Error: Error reading file 'dmdscript/errmsgs.d' Seems to be a few files missing from the zipfile ? ftp://ftp.digitalmars.com/dmdscript.1.03.zip --anders
Jan 19 2005
next sibling parent reply Martijn <mvandenboogaard gmail.com> writes:
Got the same message using dmd 0.110. You need dmd 0.111 to build dmd 
script. Although I built on Win32 so I am not sure about Linux.

Martijn.

Anders F Björklund wrote:
 Walter wrote:
 
 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.
I didn't get too far: make -f linux.mak make: *** No rule to make target `testscript.o', needed by `ds'. Stop. So I added a rule for it: dmd -c -O -release testscript.d Error: Error reading file 'dmdscript/errmsgs.d' Seems to be a few files missing from the zipfile ? ftp://ftp.digitalmars.com/dmdscript.1.03.zip --anders
Jan 19 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Martijn wrote:

 dmd -c -O -release testscript.d
 Error: Error reading file 'dmdscript/errmsgs.d'

 Seems to be a few files missing from the zipfile ?
Got the same message using dmd 0.110. You need dmd 0.111 to build dmd script. Although I built on Win32 so I am not sure about Linux.
testscript.d has a dependancy on errmsgs.d, which should have been in the Makefile. That file is then auto-generated by the Make rules. And the extra DFLAGS setting of -I.. was missing, to make it find dmdscript/ Found it out eventually... ("diff win32.mak linux.mak") --anders
Jan 19 2005
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
Ak. I always goof up something. I've attached a corrected linux.mak. BTW,
errmsgs.d is created by textgen.d.


"Anders F Björklund" <afb algonet.se> wrote in message
news:csmova$mu9$1 digitaldaemon.com...
 Walter wrote:

 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.
I didn't get too far: make -f linux.mak make: *** No rule to make target `testscript.o', needed by `ds'. Stop. So I added a rule for it: dmd -c -O -release testscript.d Error: Error reading file 'dmdscript/errmsgs.d' Seems to be a few files missing from the zipfile ? ftp://ftp.digitalmars.com/dmdscript.1.03.zip --anders
begin 666 linux.mak M9VET86P 36%R<PHC($%L;"!2:6=H=', 4F5S97)V960*(R!W=W<N9&EG:71A M;&UA<G,N8V]M"B, 5W)I='1E;B!B>2!786QT97( 0G)I9VAT" HC($)U:6QD M('=I=& 1&EG:71A;"!-87)S($0Z"B,);6%K92 M9B!L:6YU>"YM86L*" I/ M551$25(]+ H*(T1&3$%'4STM22XN("UG"D1&3$%'4STM22XN("U/("UR96QE M=6QE<SH*+F0N;R Z" D )"A$340I("UC("0H1$9,04=3*2 D*BYD" ID969A M=6QT=&%R9V5T.B!L:6)D;61S8W)I<'0N82!D<PH*(R,C(R,C(R,C(R,C(R,C M(R!214Q%05-%4R C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C" IR96QE87-E M. H);6%K92!C;&5A; H);6%K92!D<PH);6%K92!C;&5A; H*(R,C(R,C(R,C M(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,*"D]"2E,]"6ED96YT M:69I97(N;R!L97AE<BYO('!A<G-E+F\ 97AP<F5S<VEO;BYO(&5R<FUS9W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"A$ M340I("UC("0H1$9,04=3*2!D;F%T:79E+F0*"F1N=6UB97(N;R Z(&1N=6UB M97(N9 H)("0H1$U$*2 M8R D*$1&3$%'4RD 9&YU;6)E<BYD" ID;V)J96-T M+F\ .B!D;V)J96-T+F0*"2 D*$1-1"D +6, )"A$1DQ!1U,I(&1O8FIE8W0N M9 H*9')E9V5X<"YO(#H 9')E9V5X<"YD('!R;W1O97)R;W(N9 H)("0H1$U$ M*2 M8R D*$1&3$%'4RD 9')E9V5X<"YD" ID<W1R:6YG+F\ .B!D<W1R:6YG M+F0*"2 D*$1-1"D +6, )"A$1DQ!1U,I(&1S=')I;F<N9 H*97)R;7-G<RYO M(#H 97)R;7-G<RYD" D )"A$340I("UC("0H1$9,04=3*2!E<G)M<V=S+F0* M"F5X<')E<W-I;VXN;R Z(&5X<')E<W-I;VXN9 H)("0H1$U$*2 M8R D*$1& M3$%'4RD 97AP<F5S<VEO;BYD" IF=6YC=&EO;F1E9FEN:71I;VXN;R Z(&9U M;F-T:6]N9&5F:6YI=&EO;BYD" D )"A$340I("UC("0H1$9,04=3*2!F=6YC M=&EO;F1E9FEN:71I;VXN9 H*:61E;G1I9FEE<BYO(#H :61E;G1I9FEE<BYD M(&5R<FUS9W,N9 H)("0H1$U$*2 M8R D*$1&3$%'4RD :61E;G1I9FEE<BYD M" II<BYO(#H :7(N9 H)("0H1$U$*2 M8R D*$1&3$%'4RD :7(N9 H*:7)S M=&%T92YO(#H :7)S=&%T92YD" D )"A$340I("UC("0H1$9,04=3*2!I<G-T M871E+F0*"FET97)A=&]R+F\ .B!I=&5R871O<BYD" D )"A$340I("UC("0H M1$9,04=3*2!I=&5R871O<BYD" IL97AE<BYO(#H ;&5X97(N9 H)("0H1$U$ M*2 M8R D*$1&3$%'4RD ;&5X97(N9 H*;W!C;V1E<RYO(#H ;W!C;V1E<RYD M" D )"A$340I("UC("0H1$9,04=3*2 M:6YL:6YE(&]P8V]D97,N9 H*<&%R M<V4N;R Z('!A<G-E+F0*"2 D*$1-1"D +6, )"A$1DQ!1U,I('!A<G-E+F0* M"G!R;V=R86TN;R Z('!R;V=R86TN9 H)("0H1$U$*2 M8R D*$1&3$%'4RD M<')O9W)A;2YD" IP<F]P97)T>2YO(#H <')O<&5R='DN9 H)("0H1$U$*2 M M8R D*$1&3$%'4RD +6EN;&EN92!P<F]P97)T>2YD" IP<F]T;V5R<F]R+F\ M.B!P<F]T;V5R<F]R+F0*"2 D*$1-1"D +6, )"A$1DQ!1U,I('!R;W1O97)R M;W(N9 H*<V-O<&4N;R Z('-C;W!E+F0*"2 D*$1-1"D +6, )"A$1DQ!1U,I M('-C;W!E+F0*"G-C<FEP="YO(#H <V-R:7!T+F0*"2 D*$1-1"D +6, )"A$ M1DQ!1U,I('-C<FEP="YD" IS=&%T96UE;G0N;R Z('-T871E;65N="YD" D M)"A$340I("UC("0H1$9,04=3*2!S=&%T96UE;G0N9 H*<WEM8F]L+F\ .B!S M>6UB;VPN9 H)("0H1$U$*2 M8R D*$1&3$%'4RD <WEM8F]L+F0*"G1E>'0N M;R Z('1E>'0N9 H)("0H1$U$*2 M8R D*$1&3$%'4RD =&5X="YD" IT:')E M861C;VYT97AT+F\ .B!T:')E861C;VYT97AT+F0*"2 D*$1-1"D +6, )"A$ M1DQ!1U,I('1H<F5A9&-O;G1E>'0N9 H*=F%L=64N;R Z('9A;'5E+F0*"2 D M*$1-1"D +6, )"A$1DQ!1U,I("UI;FQI;F4 =F%L=64N9 H*(R,C(R,C(R,C M(R,C(R,C(R,C(R!5=&EL:71I97, (R,C(R,C(R,C(R,C(R,C(PH*97)R;7-G M<RYD(#H )"A/551$25(I+W1E>'1G96X*"20H3U541$E2*2]T97AT9V5N" HD M*$]55$1)4BDO=&5X=&=E;BYO(#H =&5X=&=E;BYD" DD*$1-1"D +6, =&5X M=&=E;BYD" HD*$]55$1)4BDO=&5X=&=E;B Z("0H3U541$E2*2]T97AT9V5N M+F\*"20H1$U$*2 M;V8D0" D*$]55$1)4BDO=&5X=&=E;BYO" HC(R,C(R,C M(R,C(R,C(R,C(R,C(%5T:6QI=&EE<R C(R,C(R,C(R,C(R,C(R,C" IC;&5A M;CH*"7)M("0H3T)*4RD =&5X=&=E;BYO('1E>'1G96X 97)R;7-G<RYD" IZ M:7 .B D*%-20RD =VEN,S(N;6%K(&QI;G5X+FUA:R!G<&PN='AT" ER;2!D M;&EN=7 N;6%K(&=P;"YT>'0*"B,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C *(R,C(R,C(R,C" `` ` end
Jan 19 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
Jan 19 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"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.
Jan 19 2005
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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 :-)
Jan 20 2005
prev sibling parent Paul Clinch <pclinch internet-glue.co.uk> writes:
Walter wrote:

 
 "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.
Yes, Walters timezone -0800 behind UTC, so time 0 ( 1 Jan 1970 ) becomes 31 Dec 1969. Regards, Paul Clinch.
Jan 24 2005
prev sibling next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter wrote:

 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. 
It needs a few extra additions to be portable beyond "linux", though : * The makefile for Linux was missing lines, and works poor with GNU Make

 #DFLAGS=-I.. -g
 

 DFLAGS=-I.. -O -release

 %.o : %.d
 	 $(DMD) -c $(DFLAGS) $<
* version (D_InlineAsm) should be used on asm{ }, with D alternatives.
 value.d:154: sorry, unimplemented: assembler statements are not supported yet
* Since version(Posix) is still missing, it fails outside Windows/Linux:
 dglobal.d:622: static assert  (0) is false
* Maybe it was obvious that it needs new DMD 0.111 features to compile ?
 value.d:531: function std.string.toString (bit b) does not match argument
types (long,uint)
 value.d:531: Error: expected 1 arguments, not 2
 dstring.d:186: undefined identifier module utf.stride
 ddate.d:89: undefined identifier module date.toUTCString
 ddate.d:89: function expected before (), not 'void'
 ddate.d:89: cannot implicitly convert expression module date.toUTCString(t) of
type int to char[]
* It seems to have some quirks with the GDC compiler, in general:
 dregexp.d: In member function `Get':
 dregexp.d:212: internal compiler error: Segmentation fault
 irstate.d:200: function gcc.builtins.__builtin_va_end (inout char*) does not
match argument types (uint*)
 irstate.d:200: cannot implicitly convert expression ap of type uint* to char*
 irstate.d:200: cast(char*)(ap) is not an lvalue
Beyond that, it looks really good! Looking forward to Darwin support... --anders
Jan 19 2005
prev sibling next sibling parent reply Martijn <mvandenboogaard gmail.com> writes:
Somehow this post ended up in the wrong thread (can't trust computers).

As a first quick test see the outcome below. This is done on a Athlon 
1.3GHz, 256Mb, WinXP SP2. Of course I had to change the 'print' 
statements to 'WScript.Echo' statements.

C:\opt\dmdscript>ds sieve.ds
Digital Mars DMDScript 1.03
www.digitalmars.com
Compiled by Digital Mars DMD D compiler
Copyright (c) 1999-2005 by Digital Mars
written by Walter Bright
1 source files
10 iterations

1899 primes
elapsed time = 260

C:\opt\dmdscript>cscript sieve.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

10 iterations


1899 primes

elapsed time = 721


C:\opt\dmdscript>
Jan 19 2005
parent reply "Walter" <newshound digitalmars.com> writes:
3x faster! Woo-hoo!


"Martijn" <mvandenboogaard gmail.com> wrote in message
news:csmqju$ok1$2 digitaldaemon.com...
 Somehow this post ended up in the wrong thread (can't trust computers).

 As a first quick test see the outcome below. This is done on a Athlon
 1.3GHz, 256Mb, WinXP SP2. Of course I had to change the 'print'
 statements to 'WScript.Echo' statements.

 C:\opt\dmdscript>ds sieve.ds
 Digital Mars DMDScript 1.03
 www.digitalmars.com
 Compiled by Digital Mars DMD D compiler
 Copyright (c) 1999-2005 by Digital Mars
 written by Walter Bright
 1 source files
 10 iterations

 1899 primes
 elapsed time = 260

 C:\opt\dmdscript>cscript sieve.js
 Microsoft (R) Windows Script Host Version 5.6
 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

 10 iterations


 1899 primes

 elapsed time = 721


 C:\opt\dmdscript>
Jan 19 2005
parent reply Manfred Nowak <svv1999 hotmail.com> writes:
Walter wrote:

 3x faster! Woo-hoo!
4x faster than the implementation from mozilla. -manfred
Jan 20 2005
parent "Walter" <newshound digitalmars.com> writes:
"Manfred Nowak" <svv1999 hotmail.com> wrote in message
news:csphgk$17s1$1 digitaldaemon.com...
 Walter wrote:

 3x faster! Woo-hoo!
4x faster than the implementation from mozilla.
Mozilla has gotten faster, then. It used to be 20x faster.
Jan 20 2005
prev sibling next sibling parent reply Kris <Kris_member pathlink.com> writes:
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?
Jan 19 2005
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"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!
Jan 19 2005
parent Kris <Kris_member pathlink.com> writes:
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
Jan 19 2005
prev sibling parent John Reimer <brk_6502 yahoo.com> writes:
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?
Jan 19 2005
prev sibling next sibling parent reply Norbert Nemec <Norbert Nemec-online.de> writes:
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!
Jan 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"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.
Jan 20 2005
parent "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
 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.
Perhaps one that doesn't create the element that you're trying to look up? :-& (Not meant as criticism. I think you're doing a great job.) L.
Jan 20 2005
prev sibling next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
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.
Jan 20 2005
parent "Walter" <newshound digitalmars.com> writes:
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message
news:cso67f$2g3u$1 digitaldaemon.com...
 FTM, what does the second D in DMDScript stand for?
Generally I was googling on *script names, looking for one I could use.
Jan 20 2005
prev sibling next sibling parent reply "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
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>
Jan 20 2005
parent Kenny B <funisher gmail.com> writes:
after some slight modification, I was able to get IE, Firefox and ds 
working. Here are the results: (winxp, amd xp 2500, 512MB ram)

(ds)
standard makfile settings: 187

(IE)
standard .html file: 500
Lionello's timer patch: 281

(Firefox)
standard .html file with 'scriptengine' line removed: 625
Lionello's timer patch + some modifications: 250

------------------

in firefox, there appears to be a bug in the js parser, because the 
timer won't release the browser into "page loaded" mode.

I'm also not really sure where there is such a huge increase in time 
between the timer and not.

And, on a side note, I just discovered D yesterday, and already have 
huge plans for it. I had to write a quick RLE implementation, and I 
chose D to do it, and I have been more than pleased :)

Thanks so much for D, and great job on DMDscript!

Kenny

Lionello Lunesu wrote:
 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>
 
 
Jan 29 2005
prev sibling next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter wrote:

 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!
Benchmarking Digital Mars dmdscript-1.03-1 versus Mozilla js-1.5-0.rc6 :
 10 iterations
 
 
 1899 primes
 
 elapsed time = 299
 Digital Mars DMDScript 1.03
 www.digitalmars.com
 Compiled by Digital Mars DMD D compiler
 Copyright (c) 1999-2005 by Digital Mars
 written by Walter Bright
 1 source files
 10 iterations
 
 1899 primes
 elapsed time = 142
Unless I am misinterpreting, seems 2x as fast ? Tested on Fedora Core 1. --anders PS. How about a runtime option to get rid of the annoying banner ? :-)
Jan 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Anders F Björklund" <afb algonet.se> wrote in message
news:cso6d2$2gc5$1 digitaldaemon.com...
 PS. How about a runtime option to get rid of the annoying banner ? :-)
It does come with source. Just use // <g>.
Jan 20 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter wrote:

PS. How about a runtime option to get rid of the annoying banner ? :-)
It does come with source. Just use // <g>.
Okay, I added a patch to only show the banner in verbose mode... I also added a small test.ds program, to avoid the default (error).
 print("Hello, World!\n");
 print("The date and time is " + Date() + "\n");
And a proper manpage, as usual... (?) http://www.algonet.se/~afb/d/d-manpages/ds.html Updated the SRPM with those changes: http://www.algonet.se/~afb/d/dmdscript-1.03-3.nosrc.rpm --anders PS. I didn't use "println", since it didn't work with Mozilla JS... For some reason "print" adds a newline in JS, making two above.
Jan 20 2005
prev sibling next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter wrote:

 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!
Here are the results from Mac OS X 10.3 "Panther": DMDScript/GDC: (does not compile yet...) * Safari: "Netscape ns" (end of page, just blank) * Camino: "Netscape ns" (end of page, just blank) * Netscape: "Netscape ns" (end of page, just blank) * Microsoft IE: "Microsoft Internet Explorer ie ScriptEngine JScript Build 3715" The webpages gave scripting errors, outside of IE: Safari:
 sieve.html:11: TypeError - Value undefined (result of expression ScriptEngine)
 is not object. Cannot be called.
Camino:
 JS error: ScriptEngine is not defined
Netscape:
 Error: ScriptEngine is not defined
 Source File: sieve.html
 Line: 11
After commenting that out and fixing the HTML to follow W3C standards, here are some results in numbers (which varies a lot, just examples): * Netscape 7.2: elapsed time = 3470 * Safari 1.2.4: elapsed time = 3419 * Camino 0.8.2: elapsed time = 2363 * Internet Explorer 5.2: elapsed time = 1922 --anders
Jan 20 2005
prev sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:csmgiq$bdr$1 digitaldaemon.com...
 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.
Sounds cool. Is there an API to the dscript engine? I can't tell browsing the source directory how to plug it into an application.
Jan 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:csp2t6$ljb$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:csmgiq$bdr$1 digitaldaemon.com...
 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.
Sounds cool. Is there an API to the dscript engine? I can't tell browsing the source directory how to plug it into an application.
To add a function, just add it in like the ones in dglobal.d. To create a new object type, I'd just copy the code in protoerror.d and modify it to suit.
Jan 20 2005
parent reply Chris Sauls <Chris_member pathlink.com> writes:
In article <csp4pm$o45$4 digitaldaemon.com>, Walter says...
To add a function, just add it in like the ones in dglobal.d. To create a
new object type, I'd just copy the code in protoerror.d and modify it to
suit.
Think one day the DMDScript engine will be available as a truly just-link-in library? I can't help dreaming of code like: Any chance of it? Or is that do-able now with some boilerplate? -- Chris Sauls
Jan 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csp9vu$v61$1 digitaldaemon.com...
 In article <csp4pm$o45$4 digitaldaemon.com>, Walter says...
To add a function, just add it in like the ones in dglobal.d. To create a
new object type, I'd just copy the code in protoerror.d and modify it to
suit.
Think one day the DMDScript engine will be available as a truly
just-link-in
 library?  I can't help dreaming of code like:










 Any chance of it?  Or is that do-able now with some boilerplate?
It's doable now. Look at protoerror.d.
Jan 20 2005
parent reply Chris Sauls <Chris_member pathlink.com> writes:
In article <cspks9$1c6h$2 digitaldaemon.com>, Walter says...
"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csp9vu$v61$1 digitaldaemon.com...









 Any chance of it?  Or is that do-able now with some boilerplate?
It's doable now. Look at protoerror.d.
Well today I did get around to looking at it, and attempted to add a class to DMDScript, without editing the engine.. And after only an hour of experimenting, can declare 100% succes! I think I know of a few projects (such as my friend's bittorrent client, and our envisioned 100% D MUD server) which could benefit from this... To show what I accomplished, I got the following DMDScript to execute, with the shown output. Obviously "Monkey" is the class I added. dsext.ds output You should really write up an official how-to on this, though... I'm sure there's some things I'm missing yet, even though it works. Meanwhile, thanks for quite a nifty new tool! -- Chris Sauls
Jan 22 2005
parent reply "Walter" <newshound digitalmars.com> writes:
Nice! How about posting monkey.d here?

"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csut90$1te8$1 digitaldaemon.com...
 In article <cspks9$1c6h$2 digitaldaemon.com>, Walter says...
"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csp9vu$v61$1 digitaldaemon.com...









 Any chance of it?  Or is that do-able now with some boilerplate?
It's doable now. Look at protoerror.d.
Well today I did get around to looking at it, and attempted to add a class
to
 DMDScript, without editing the engine..  And after only an hour of
 experimenting, can declare 100% succes!  I think I know of a few projects
(such
 as my friend's bittorrent client, and our envisioned 100% D MUD server)
which
 could benefit from this...

 To show what I accomplished, I got the following DMDScript to execute,
with the
 shown output.  Obviously "Monkey" is the class I added.

 dsext.ds














 output









 You should really write up an official how-to on this, though...  I'm sure
 there's some things I'm missing yet, even though it works.  Meanwhile,
thanks
 for quite a nifty new tool!

 -- Chris Sauls
Jan 22 2005
parent reply Chris Sauls <ibisbasenji gmail.com> writes:
Walter wrote:
 Nice! How about posting monkey.d here?
Actually its 'dsext.d' but I will do / have done. It isn't much... but I think based on this I should be able to find a nice smooth way of doing it. A friend and I are thinking we could combine it with Sofu to create classes from files. :) Yes we do get bored sometimes. -- Chris Sauls
Jan 22 2005
parent "Walter" <newshound digitalmars.com> writes:
Thanks!
Jan 24 2005