You are not logged in.
Great job, you guys!
Can't wait to try this! Is the mozjs.dll file for SM 24 bigger?
Please don't forget to notify us here when it's done and the link to the new mozjs.dll
AB, the next day (april 8), we plan to merge current version SynSM & SynSMAPI with our new SM24 implementation, so please - do not modify sources.
Full list of changes can to JavaScript be found here:
Changes in SM 18
Changes in SM 19
Changes in SM 20
Changes in SM 21
Changes in SM 22
Changes in SM 23
Changes in SM 24After this we start to:
redesign our debugger implementation to be contributed to mORMot ( Yes, we have debugger )
redesign out TObject descendant import mechanism to be contributed to mORMot
Last allow write in delphi (for "old" RTTI):
TMyClass = class published function write(cx: PJSContext; argc: uintN; vp: pjsval): JSBool; // for OLD RTTI - only this signature of function property myProp: integer; // but all kind of property end; TSMEngine.registerClass(TMyClass);
And when in SM
var inst = new TMyClass(); inst.write('some arg'); inst.myProp;
Also we have the same but for new RTTI - it allow to publish to SM almost all methods of TObject
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hi Arnaud,
With respect, I assume currently others sending you source code using email, wouldn't it much convenient for communication if the source code is hosted on github.com? Other can contribute to the source too.
Hello Pavel?
Any news?
:-)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
You can contribute directly on our fossil server http://synopse.info/fossil
GitHub would not offer anything more.
See http://www.fossil-scm.org/index.html/do … v-git.wiki
Contributions are always welcome (we never refused to give a developer access account to our fossil repository), and any external commit is always validated and (most of the time) refactored before integration.
For instance, it should meet our KISS code style and high quality documentation criteria.
When we did input some code of external contribution directly into the trunk, with very small code review and validation, it was much difficult to integrate it later.
Most of the time, we prefer to merge the code here at Synopse.
It allows peer review, avoid most unexpected regressions, and sometimes add a more open way of implementing things.
Offline
Is the mozjs.dll file for SM 24 bigger?
mozjs-24.dll = 3 030 016 bytes
mozjs-17.dll = 1 729 536 bytes
Size increased mainly because of many C++ functions added.
Any news?
almost finished. I think tomorrow or in Saturday I commit.
While merge we switch to last mORMot version and found very interesting bug (we think it is in out SM module or inside Mozilla, spend many time and found it inside last TTextWriter.AddNoJSONEscapeW version).
See http://synopse.info/fossil/tktview?name=a75c0c6759
Offline
@mpv, thanks for the update. The scale of file size is not a big deal.
@ab, I think it's not about the version control features, but the popularity of the system - how are the client programs? How many good tutorials? I assume many developers have used svn or git already. But I understand the reasons not to switch on your side.
You can contribute directly on our fossil server http://synopse.info/fossil
GitHub would not offer anything more.
See http://www.fossil-scm.org/index.html/do … v-git.wikiContributions are always welcome (we never refused to give a developer access account to our fossil repository), and any external commit is always validated and (most of the time) refactored before integration.
For instance, it should meet our KISS code style and high quality documentation criteria.
When we did input some code of external contribution directly into the trunk, with very small code review and validation, it was much difficult to integrate it later.Most of the time, we prefer to merge the code here at Synopse.
It allows peer review, avoid most unexpected regressions, and sometimes add a more open way of implementing things.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
@mpv, at the beginning of the development, you avoided v8 because it provides c++ interfaces which is more complex than C API, I think you did not expect SpiderMonkey would drop C API, right?
starting from SM24 mozilla drop support for C api (only c++).
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hi ab and mpv,
A new finding: Browserify.org (http://browserify.org/) contains the browser versions of many node modules, and I did not dig deeply, but I guess those modules should work fine with spidermonkey without or with minimal changes.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
We finish modification of SynSM* to migrate to SM24.
Bad news: on "22 - JavaScript HTTPApi web server" we see 20% performance lost on hi load
>wrk -c1000 -t10 http://host:888/root/readme.md
on SM17 give 16000 RPS, on SM24 - 13000.
We continue investigation - may be we need to change compiler (currently we compile SM using Visual Studio 2010). But IMHO this is because internally many features migrate form C to C++.
Good news:
- we also include dubugger low-level API in this commit. (GUI part we commit later)
- now we know how to add two way ArrayBuffer support - this give us possibility to exchange binary data with SM. We commit this feature in few days.
I think you did not expect SpiderMonkey would drop C API, right?
Yes, this is unexpected Mozilla design. But internally all function we need is steel have C-style, so we only need to modify some C++ headers.
Browserify.org
Yes, we know this lib. Some part work, some - not. The main problem is setTimeout/setInterval.
@AB - I will definitely find the time to learn Fossil - I use tortioseSVN for last 10 year and very used to the GUI and IDE integration. IMHO this is the main things fossil is mis.
While sending a letter..
Offline
Thanks for sharing.
This performance regression is indeed disappointing...
I found out that VS 2010 has a good compiler under Windows.
Perhaps gcc may work better, but you are right: it is probably not the compiler, but the new C++ based architecture - perhaps the gcc RTL is more optimized.
Offline
>wrk -c1000 -t10 http://host:888/root/readme.md
This is interesting, I want to do a load test here too, I did a google search and it led me to this github repository (https://github.com/wg/wrk), but I'm not sure how to install and use it on **Windows**, any hints?
- we also include dubugger low-level API in this commit. (GUI part we commit later)
Congratulations on the great work! A debugger API is really a nice addition!
@AB - I will definitely find the time to learn Fossil - I use tortioseSVN for last 10 year and very used to the GUI and IDE integration. IMHO this is the main things fossil is missing.
While sending a letter..
Same here, that's why I suggest to move the source code to google code or github, but keep everything here. Just my suggestions.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Some part work, some - not. The main problem is setTimeout/setInterval.
Forget to ask: I assume we can implement those two functions as native functions in the Delphi host?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
ok, on my i5/6GB local PC, I just did a load test using a command line tool called openload (http://openwebload.sourceforge.net/) and got the following result, using the nightly build ( I think it's SpiderMonkey 1.8.5):
D:\>openload localhost:888/root/readme.md 1000
URL: http://localhost:888/root/readme.md
Clients: 1000
MaTps 814.00, Tps 814.00, Resp Time 0.138, Err 0%, Count 814
MaTps 907.20, Tps 1746.00, Resp Time 0.074, Err 0%, Count 2560
MaTps 985.53, Tps 1690.55, Resp Time 0.072, Err 0%, Count 4259
MaTps 1056.18, Tps 1692.00, Resp Time 0.079, Err 0%, Count 5951
MaTps 1120.82, Tps 1702.59, Resp Time 0.074, Err 0%, Count 7657
MaTps 1167.62, Tps 1588.82, Resp Time 0.081, Err 0%, Count 9249
MaTps 1208.67, Tps 1578.06, Resp Time 0.080, Err 0%, Count 10846
MaTps 1259.41, Tps 1716.12, Resp Time 0.075, Err 0%, Count 12581
The second column, Tps, is the number of completed requests during a second.
I will do the same test once I got the SM24 version and we'll see how it'll go.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
I start new topic about load testing - http://synopse.info/forum/viewtopic.php?id=1700
About native implementation of setTimeout/setInterval - this is not easy. To implement it we need to implement something like Coroutine
Offline
Offline
It seems we solve performance problem. This is because Garbage collection model is changed in SM24. We need small additional investigation how to tune it.... Commit coming soon..
That's really excellent job mpv!
At a later time I **maybe** (just maybe) benchmark SM with the Besen pure Pascal implementation JS engine
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Here we are back!
I've integrated SM 24, and updated the binaries.
See http://synopse.info/fossil/info/687f12d548
What about the small GC-related performance issue?
What about providing the C wrapper source code?
Feedback is welcome!
Offline
Here we are back!
I've integrated SM 24, and updated the binaries.
See http://synopse.info/fossil/info/687f12d548What about the small GC-related performance issue?
What about providing the C wrapper source code?Feedback is welcome!
I suggest mpv to host the C wrapper source code on github or google code, since it's standalone. And this is really an excellent idea to get around the difficulty of wrapping c++ library using Delphi!
I think I'll be able to test it in the near future
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
We are still looking for the performance problem. SM24 itself is very fast, but if we use it via our wrapper something going wrong (seems IonMonkey not work). So we need more time to solve problem.
Simple test:
function factorial(val){
return val === 1 ? 1 : val * factorial(val-1);
}
var d = new Date();
var res = 0;
for (var i = 0; i < 500000; i++){
res += factorial(100);
}
d = new Date().getTime() - d.getTime();
sm24.exe - 983ms
sm17.exe - 2600ms
our wrapper for sm42 - 7800ms (the same result with jsoIon and without jsoIon, so it not work)
native Delphi implementation - 1100ms
So sm24 itself is faster when native Delphi... Very unexpected for me.
Native code:
procedure TForm1.btn1Click(Sender: TObject);
var
n, x: Integer;
res: Double;
T: TPrecisionTimer;
function factorial(x: Integer): Double;
begin
if x = 1 then
result := x
else
result := x * factorial(x-1);
end;
begin
res := 0; x := 100;
T.Start;
for n := 0 to 500000 do
res := res + factorial(x);
mmoRes.Lines.Add(T.Stop);
mmoRes.Lines.Add(FloatToStr(res));
end;
Offline
Delphi generates very unoptimized x87 FPU code, which is much slower than the SSE code JITted by SM.
See http://www.delphitools.info/2011/09/02/ … erformance
Yes, IonMonkey is a need...
Is there not any flag or API to explicitly enable it when initializing the runtime?
Offline
is it possible that the problem is coming from the c wrapper?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hi mpv, does the spiderMonkey dll expose the JS parser API that can generate AST (abstract syntax tree), as described here:
https://developer.mozilla.org/en-US/doc … Parser_API
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
We finish performance problem solving. Regressiin test AB provide also fixed. Tonight we prettify code and describe the root of problem we solv. Also we add ArayBuffer API.
About AST - this is actually a part of Firefox, not SM itself. But on the low level it is posible to do the same operation as in reflect.jsm...
Offline
Great! Great! You guys!
I'll check the low level API someday.
We finish performance problem solving. Regressiin test AB provide also fixed. Tonight we prettify code and describe the root of problem we solv. Also we add ArayBuffer API.
About AST - this is actually a part of Firefox, not SM itself. But on the low level it is posible to do the same operation as in reflect.jsm...
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
I received the files so I will update the source code repository soon....
Great job ab and mpv! Yester day I downloaded and it complied and the jshttpserver demo worked.
I've got a question for mpv though, shortly I'll need to make a decision on using the spidermonkey wrapper, one key factor would be, are you planning to release the source code of the 'c wrapper over the c++' ab mentioned earlier? Thanks.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Yes, we will create patch for Mozilla mercurial repository ASAP. But I'm little bit busy now
Great! And you must know that I'm not pushing you, just need to make sure you'll eventually release it, time frame is not a concern
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hi Folks, any news on this
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
@ab, would you contact mpv via e-mail ask for the source code of the DLL which he promised to publish it? I think it's a key aspect to keep the JavaScript part of the mORMot framework live and going?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hello. Sorry that disappeared....
We sand patch (and instruction) for C++ SpiderMonkey dll compilation to AB's e-mail.
@edwinsn - about your question about AST (abstract syntax tree) generation - take a look at http://ternjs.net - this is JS parser written on JS
Offline
@mpv, welcome back! And great to hear that. And yes I already know Ternjs, which is written by an amazing developer!
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
We have updated the SynSM/SynSMAPI units:
http://synopse.info/fossil/info/5ca6fab … 75cd1e25f0
And added the mozjs patches to our source code repository:
http://synopse.info/fossil/info/f10b5ce … 0f8152e2eb
See http://synopse.info/fossil/dir?ci=tip&n … &type=tree for a tree view of the new folder.
There are low-level compilation instruction available, too.
Thanks mpv for sharing!
Offline
Thank you guys!
I checked the BuildInstruction.md file, there is only one thing not clear to me - what program to use to apply those .patch files? Thanks.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
*.patch is unified diff format. We generate out patch (Delphi patch.patch) using mercurial - the same repository Mozilla use. But you can apply this patch by any software, support unified diff (svn e.t.c.). In case of mercurial - more information here: http://mercurial.selenic.com/wiki/PatchFile. In short:
>hg import my-patch-file.patch
or visually using tortoiseHg - http://tortoisehg.bitbucket.org/manual/1.0/patches.html
Last edited by mpv (2014-07-04 09:35:05)
Offline
Hi MPV,
It's great! Thanks for the help. I'm not trying to build the dll in the near future, just wanted to get things clarified
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
@mpv What things to do in JS_AbortIfWrongThread in sm, in delphi debug evironment, I found it raise zero point write av exception.
Hope reply.
Offline
You try to do something with javaScript runtime not from thread this runtime created. If this happens in delphi debugger in multithread application this is "normal" situation, because debugger thread is not a thread where runtime initially created. In our implementation we create one runtime and one context per thread. See Mozilla sources:
JSRuntime::abortIfWrongThread() const
{
if (ownerThread_ != PR_GetCurrentThread())
MOZ_CRASH();
if (!js::TlsPerThreadData.get()->associatedWith(this))
MOZ_CRASH();
}
Offline
You try to do something with javaScript runtime not from thread this runtime created. If this happens in delphi debugger in multithread application this is "normal" situation, because debugger thread is not a thread where runtime initially created. In our implementation we create one runtime and one context per thread. See Mozilla sources:
JSRuntime::abortIfWrongThread() const { if (ownerThread_ != PR_GetCurrentThread()) MOZ_CRASH(); if (!js::TlsPerThreadData.get()->associatedWith(this)) MOZ_CRASH(); }
Thanks mpv very much. I have read these statement above from sm source and I have trace into cpu viewer for asm, but my asm knowledge as my english, haha...
Thanks excellent sm wrapper again!
Offline
Agree with ab. Now SynSM hides so deep.
Offline
Hi @mpv,
Where is the debugger?
Offline
In our product we already integrate debugger. This feature consist of 3 part:
GUI (very specific to my application, so can not be shared) <-> Controller <-> TDebugger ( Object wrapper around SpiderMonkey debugger functions )
Controller and Debugger code still depend from my application so not ready yet for sharing (but we work on remove this dependency).
If you need it now, I can send you Controller and Debugger code to use as a sample for your implementation.....
Please, write me a mail ( my e-mail inside SynSMAPI header).
Offline
Controller and Debugger code still depend from my application so not ready yet for sharing (but we work on remove this dependency).
@mpv, that is a great news!
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Spidermonkey has passed V8 on Octane performance on arewefastyet, and is now leading V8 and JSC on Octane, Sunspider and Kraken.
http://robert.ocallahan.org/2014/10/are … e-are.html
Offline