You have a javascript engine, 'engine.js' in directory 'JSengine' on a HDD together with node.exe version 'A' in the same directory. You also have node version 'B' installed on an SSD, the path environment variable containing its path.
You install engine.js under Arena in two ways: one as '<path to JSengine>\node.exe engine.js', the other as 'node <path to JSengine>\engine.js. In other words, the first one uses node A started from the engine's directory, the second one uses node B started from node B's directory.
And now the question: Is it possible that one of the engines plays better than the other?
Javascript question
Moderators: hgm, Rebel, chrisw
-
- Posts: 1362
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Szentendre, Hungary
- Full name: Gabor Szots
Javascript question
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Javascript question
I don't know, in theory a newer version of node may have a better JIT compiler so if the engine runs faster with newer node then it might in theory score better.
JS typically runs about 4 times slower than C/C++, but it really depends on the program. In the case of chess engines which typically contain a lot of jumps, the gap between JS and C++ might be actually lower than a factor of 4.
JS typically runs about 4 times slower than C/C++, but it really depends on the program. In the case of chess engines which typically contain a lot of jumps, the gap between JS and C++ might be actually lower than a factor of 4.
Martin Sedlak
-
- Posts: 11585
- Joined: Thu Mar 09, 2006 12:57 am
- Location: Birmingham UK
Re: Javascript question
mar wrote: ↑Sun Feb 28, 2021 6:00 pm I don't know, in theory a newer version of node may have a better JIT compiler so if the engine runs faster with newer node then it might in theory score better.
JS typically runs about 4 times slower than C/C++, but it really depends on the program. In the case of chess engines which typically contain a lot of jumps, the gap between JS and C++ might be actually lower than a factor of 4.
This brings back memories of trying to work out which version of Java was running code when more than one version of Java was installed on a PC!
My answer to the OP would be that I'd expect the two different ways of starting JS programs to not impact speed, but computers and OSs are complex and you never know what implementation detail you're not aware of might be having an effect.
For a complex program, I would expect JS to be more than 4x slower than a compiled program: it was over 20 years ago, but I remember issues like multi-dimensional arrays running like a three-legged dog under JS.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Javascript question
AFAIK 20 years ago JS used to be interpreted, these days it's JIT-compiled into machine code
Martin Sedlak
-
- Posts: 4607
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Javascript question
Did you try to just measure the average speed on some positions?Gabor Szots wrote: ↑Sun Feb 28, 2021 5:53 pm You have a javascript engine, 'engine.js' in directory 'JSengine' on a HDD together with node.exe version 'A' in the same directory. You also have node version 'B' installed on an SSD, the path environment variable containing its path.
You install engine.js under Arena in two ways: one as '<path to JSengine>\node.exe engine.js', the other as 'node <path to JSengine>\engine.js. In other words, the first one uses node A started from the engine's directory, the second one uses node B started from node B's directory.
And now the question: Is it possible that one of the engines plays better than the other?
Various node versions really can make a difference (but I doubt by more than 20%).
I was forced to test various node versions for Wukong after my old node did not run with it and my last JS tests were from 4-5 years ago.
For me it was even more complicated, because being on Win7 on old hardware newest nodes didn't work either ;-)
http://talkchess.com/forum3/viewtopic.p ... 18#p878815
https://rwbc-chess.de
trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
-
- Posts: 1362
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Szentendre, Hungary
- Full name: Gabor Szots
Re: Javascript question
That was a good idea. I measured almost no difference.
This was with Lozza. In a tournament it started rather 'slow', then I changed the installation method and it improved. Odd was that better results were achieved using the older node. Must have been a statistical fluke, number of games was not particularly high.
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 4607
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Javascript question
If you want I could look into the games.Gabor Szots wrote: ↑Sun Feb 28, 2021 7:31 pmThat was a good idea. I measured almost no difference.
This was with Lozza. In a tournament it started rather 'slow', then I changed the installation method and it improved. Odd was that better results were achieved using the older node. Must have been a statistical fluke, number of games was not particularly high.
https://rwbc-chess.de
trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
-
- Posts: 490
- Joined: Tue Feb 04, 2014 12:25 pm
- Full name: Colin Jenkins
Re: Javascript question
I follow the V8 engine twitter account and they are constantly improving it. Very old nodes from ~2015 had some bugs: if I used const instead of var Lozza got slower, ditto if I used switch. I always try and keep up to date with the latest node assuming it's better than previous ones. Performance is a big thing for them so I think it's a safe assumption. As you have discovered modern nodes need Windows 8.1 at least. Also Lozza 2.0 needs a fairly modern node and will stall on very old ones.
PS: To use Lozza 2.0 on old nodes on Windows 7, comment out the line below like this:-
//process.stdin.resume();
Ditto for Tomitank.
PS: To use Lozza 2.0 on old nodes on Windows 7, comment out the line below like this:-
//process.stdin.resume();
Ditto for Tomitank.
-
- Posts: 1362
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Szentendre, Hungary
- Full name: Gabor Szots