digitalmars.D - Announcing DMDScript for D!
- "Walter" <newshound digitalmars.com> Jan 19 2005
- "Charles" <no email.com> Jan 19 2005
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Jan 19 2005
- Martijn <mvandenboogaard gmail.com> Jan 19 2005
- "Walter" <newshound digitalmars.com> Jan 19 2005
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Jan 19 2005
- "Walter" <newshound digitalmars.com> Jan 19 2005
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Jan 20 2005
- Paul Clinch <pclinch internet-glue.co.uk> Jan 24 2005
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Jan 19 2005
- Martijn <mvandenboogaard gmail.com> Jan 19 2005
- "Walter" <newshound digitalmars.com> Jan 19 2005
- Manfred Nowak <svv1999 hotmail.com> Jan 20 2005
- "Walter" <newshound digitalmars.com> Jan 20 2005
- Kris <Kris_member pathlink.com> Jan 19 2005
- "Walter" <newshound digitalmars.com> Jan 19 2005
- Kris <Kris_member pathlink.com> Jan 19 2005
- John Reimer <brk_6502 yahoo.com> Jan 19 2005
- Norbert Nemec <Norbert Nemec-online.de> Jan 20 2005
- "Walter" <newshound digitalmars.com> Jan 20 2005
- Stewart Gordon <smjg_1998 yahoo.com> Jan 20 2005
- "Walter" <newshound digitalmars.com> Jan 20 2005
- "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> Jan 20 2005
- Kenny B <funisher gmail.com> Jan 29 2005
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Jan 20 2005
- "Walter" <newshound digitalmars.com> Jan 20 2005
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Jan 20 2005
- "Ben Hinkle" <bhinkle mathworks.com> Jan 20 2005
- "Walter" <newshound digitalmars.com> Jan 20 2005
- Chris Sauls <Chris_member pathlink.com> Jan 20 2005
- "Walter" <newshound digitalmars.com> Jan 20 2005
- Chris Sauls <Chris_member pathlink.com> Jan 22 2005
- "Walter" <newshound digitalmars.com> Jan 22 2005
- Chris Sauls <ibisbasenji gmail.com> Jan 22 2005
- "Walter" <newshound digitalmars.com> Jan 24 2005
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
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
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
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
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
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
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
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
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
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
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
"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
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
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
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# Debug build #DFLAGS=-I.. -g # Release build DFLAGS=-I.. -O -release
# Makerules: %.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
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
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
Walter wrote:3x faster! Woo-hoo!
4x faster than the implementation from mozilla. -manfred
Jan 20 2005
"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
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
"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
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
provide a "shakedown cruise"? Or are somehow not subtantial, professional-quality applications? Or did not already prove that D has
takes ... ? It's interesting to see you do something like this, but I'm more than a
surprised at the language utilized here -- it can rather easily be
as "this is the first time anything of value has been done with D" ...
by lots of big exclamation marks I sure hope you didn't intent it to come off in this manner. There again,
suspect the vast majority of this newsgroup already /knows/ all of these
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
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. Imeant 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
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
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
"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
more efficient, but a threefold speedup seems more like you did some
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
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
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!
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
"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
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
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
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 : # js sieve.ds10 iterations 1899 primes elapsed time = 299
# ds sieve.dsDigital 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
"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
Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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
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
"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
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
"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
implementation of the ECMA 262 scripting language (also known as javascript). The engine is written 100% in D, comes with full source
and linkable libraries for Windows and linux. This means that any D application for which adding on scripting capability makes sense can now
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
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: # # private import etc.dmdscript.dmdscript; // or... something # # static this() { # // Where Foo is a class implementing some standard interface # // Maybe IScriptObject or the like # DMDScript.registerObject("Foo", &(Foo.scriptFactory)); # } # Any chance of it? Or is that do-able now with some boilerplate? -- Chris Sauls
Jan 20 2005
"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
library? I can't help dreaming of code like: # # private import etc.dmdscript.dmdscript; // or... something # # static this() { # // Where Foo is a class implementing some standard interface # // Maybe IScriptObject or the like # DMDScript.registerObject("Foo", &(Foo.scriptFactory)); # } # Any chance of it? Or is that do-able now with some boilerplate?
It's doable now. Look at protoerror.d.
Jan 20 2005
In article <cspks9$1c6h$2 digitaldaemon.com>, Walter says..."Chris Sauls" <Chris_member pathlink.com> wrote in message news:csp9vu$v61$1 digitaldaemon.com...# private import etc.dmdscript.dmdscript; // or... something # # static this() { # // Where Foo is a class implementing some standard interface # // Maybe IScriptObject or the like # DMDScript.registerObject("Foo", &(Foo.scriptFactory)); # } # 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 # # var helloStr = "Hello world! (from DMDScript!!!)"; # print("\n", helloStr, "\n"); # # var monkey = new Monkey; # # println(monkey); # println("monkey.furColor = \"", monkey.furColor, "\""); # println("monkey.hungry = ", monkey.hungry); # println("Calling monkey.eatBanana()"); # monkey.eatBanana(); # println("monkey.hungry = ", monkey.hungry); # output # # Hello world! (from DMDScript!!!) # [object Monkey] # monkey.furColor = "brown" # monkey.hungry = 1 # Calling monkey.eatBanana() # monkey.hungry = 0 # 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
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...# private import etc.dmdscript.dmdscript; // or... something # # static this() { # // Where Foo is a class implementing some standard interface # // Maybe IScriptObject or the like # DMDScript.registerObject("Foo", &(Foo.scriptFactory)); # } # 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
DMDScript, without editing the engine.. And after only an hour of experimenting, can declare 100% succes! I think I know of a few projects
as my friend's bittorrent client, and our envisioned 100% D MUD server)
could benefit from this... To show what I accomplished, I got the following DMDScript to execute,
shown output. Obviously "Monkey" is the class I added. dsext.ds # # var helloStr = "Hello world! (from DMDScript!!!)"; # print("\n", helloStr, "\n"); # # var monkey = new Monkey; # # println(monkey); # println("monkey.furColor = \"", monkey.furColor, "\""); # println("monkey.hungry = ", monkey.hungry); # println("Calling monkey.eatBanana()"); # monkey.eatBanana(); # println("monkey.hungry = ", monkey.hungry); # output # # Hello world! (from DMDScript!!!) # [object Monkey] # monkey.furColor = "brown" # monkey.hungry = 1 # Calling monkey.eatBanana() # monkey.hungry = 0 # 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,
for quite a nifty new tool! -- Chris Sauls
Jan 22 2005
Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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









"Charles" <no email.com> 