January 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!

Benchmarking Digital Mars dmdscript-1.03-1 versus Mozilla js-1.5-0.rc6 :

# js sieve.ds
> 10 iterations
> 
> 
> 1899 primes
> 
> elapsed time = 299

# 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 = 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 ? :-)
January 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.


January 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
January 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
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.


January 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.


January 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>.


January 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
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.


January 20, 2005
Anders F Björklund wrote:
> Walter wrote:
> 
> The "minimal test suite" suite.ds fails, by the way ?
> 
>> Error: assert() line 1407
> 

Same here, on Windows XP and 2000. Oddly, on Linux everything went smoothly.

_______________________
Carlos Santander Bernal
January 20, 2005
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.


January 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