JSDB 1.8 released

1 view
Skip to first unread message

Shanti Rao

unread,
Nov 11, 2009, 12:07:23 PM11/11/09
to JSDB
Hi folks,

JSDB version 1.8, with the Just-in-time compiler, is now ready for
Windows, Linux, and OSX.

Get it at http://www.jsdb.org/

It may or may not compile for SunOS, depending on how your compiler
defines integers.

Shanti

Michiel Crefcoeur

unread,
Nov 11, 2009, 12:24:24 PM11/11/09
to js...@googlegroups.com
Great!
I assume "with the JIT compiler" means JSDB now uses TraceMonkey instead of SpiderMonkey?
Couldn't find this info, license.txt still mentions SpiderMonkey.
The latest version is not yet visible on the download and history page. ;-)
One more thing: I ran the version.js right after downloading and it sends me to the update page even though my version.txt is the same as the online one.

2009/11/11 Shanti Rao <sha...@shantirao.com>

Shanti Rao

unread,
Nov 11, 2009, 1:52:50 PM11/11/09
to JSDB
Thanks, Michiel. Try again.

Shanti

On Nov 11, 9:24 am, Michiel Crefcoeur <mpc...@gmail.com> wrote:
> Great!
> I assume "with the JIT compiler" means JSDB now uses TraceMonkey instead of
> SpiderMonkey?
> Couldn't find this info, license.txt still mentions SpiderMonkey.
> The latest version is not yet visible on the download and history page. ;-)
> One more thing: I ran the version.js right after downloading and it sends me
> to the update page even though my version.txt is the same as the online one.
>
> 2009/11/11 Shanti Rao <sha...@shantirao.com>
>
>
>
> > Hi folks,
>
> > JSDB version 1.8, with the Just-in-time compiler, is now ready for
> > Windows, Linux, and OSX.
>
> > Get it athttp://www.jsdb.org/

Jason S

unread,
Nov 12, 2009, 12:54:31 PM11/12/09
to JSDB
we can rebuild it... better... faster... stronger.... ;)

1.7.3.5:
function fib(n) { return n <= 1 ? 1 : (fib(n-1)+fib(n-2)); }
function doit(f,n) {
var d1=new Date(); var x=f(n); var d2=new Date();
writeln('f('+n+')='+x+', time='+(d2-d1)+' msec');
}

js>doit(fib,10)
f(10)=89, time=0 msec
js>doit(fib,20)
f(20)=10946, time=16 msec
js>doit(fib,25)
f(25)=121393, time=110 msec
js>doit(fib,30)
f(30)=1346269, time=1281 msec
js>doit(fib,35)
f(35)=14930352, time=14719 msec

In 1.8.0:
js>doit(fib,10)
f(10)=89, time=0 msec
js>doit(fib,20)
f(20)=10946, time=15 msec
js>doit(fib,25)
f(25)=121393, time=78 msec
js>doit(fib,30)
f(30)=1346269, time=843 msec
js>doit(fib,35)
f(35)=14930352, time=9453 msec

Jason S

unread,
Nov 12, 2009, 1:01:38 PM11/12/09
to JSDB
function loop(n) { for (var i = 0; i < n; ++i) ; return n;}

1.7.3.5:

js>doit(loop,1e7)
f(10000000)=10000000, time=1296 msec

1.8.0.0:

js>doit(loop,1e7)
f(10000000)=10000000, time=672 msec

FoxZ

unread,
Nov 13, 2009, 6:14:36 AM11/13/09
to JSDB
My own test

JSDB 1.8 3600
JSDB 1.7 4300

But
SAFARI 4.0.3 2000


var z={
0:{id:"A",nodes:[1,2,3,5,6,8]},
1:{id:"B",nodes:[0,4,8]},
2:{id:"C",nodes:[0,4,7,8]},
3:{id:"D",nodes:[0,4,8]},
4:{id:"E",nodes:[1,2,3,5,6,8]},
5:{id:"F",nodes:[0,4,8]},
6:{id:"G",nodes:[0,4,7,8]},
7:{id:"H",nodes:[0,4,8]},
8:{id:"I",nodes:[0,1,2,3,4,5,6,7]}

};

function r(z,n){
if(!n.pass){
n.pass=true;
for (var m in n.nodes) r(z,z[n.nodes[m]]);
n.pass=false;
}

}

var s=new Date();
for (var x=0;x!=100;x++) {
for (var n in z) r(z,z[n]);
};

var t=new Date();
write (t-s,"\n");

Shanti Rao

unread,
Nov 13, 2009, 4:55:14 PM11/13/09
to JSDB
You can make this code run 4x faster in either version by this simple
substitution:

Replace

for (var m in n.nodes) r(z,z[n.nodes[m]]);

with

for (var m=0;m<n.nodes.length;m++) r(z,z[n.nodes[m]]);

When iterating over arrays, "for ... in" has to create a list of
objects for every iteration.

TraceMonkey only compiles loops, so it won't help with recursion. Try
unwrapping and making a while() or for() loop.

See http://hacks.mozilla.org/2009/07/tracemonkey-overview/

JSDB 1.8 is built with the FireFox 3.5.0 version of TraceMonkey.

Shanti

Yak

unread,
Nov 23, 2009, 6:04:09 AM11/23/09
to JSDB
Far be it from me to utter criticism but (there's always a but that
completely contradicts the first part):

If i follow the tracemonkey overviewlink and check the difference in
the first example. On my system it gives these results:

FF 3.0.15 >> 1858ms
FF 3.5.5 >> 37ms

Slightly altering the code to:

function addTo(a, n) {
for (var i = 0; i < n; ++i)
a = a + i;
return a;
}

var t0 = new Date();
var n = addTo(0, 10000000);
writeln(n);
writeln(new Date() - t0);

And running it in jsdb gives:

jsdb 1.7.? >> 3383ms
jsdb 1.8.0 >> 2207ms

Now I'm not shocked by the difference between ff3.0 and jsdb1.7 But
the ration 1.7/1.8 is unexpectedly low.

Any thoughts?

KR, yak





Reply all
Reply to author
Forward
0 new messages