nodejs / node-chakracore

Node.js on ChakraCore :sparkles::turtle::rocket::sparkles:
Other
1.92k stars 341 forks source link

Slow TCP #6

Open morkai opened 8 years ago

morkai commented 8 years ago

So I've decided to see how node-chakracore v6.0.0-pre1 will compare to node-v8 v5.4.0 in generating reports in one of my apps (~500k documents fetched from MongoDB). On average node-chakracore took 2x more time to finish than node-v8.

Then I tried to import data from 27 ~8 MB text files. Parsing (CPU only) in ChakraCore was faster than in v8 (chakra=6.8s vs v8=5.6s), but then came time for some I/O (MongoDB) and there v8 won again (chakra=143s vs v8=50s).

Simple TCP client-server scripts show that the net module is 2x slower in ChakraCore (92k data events per second in v8 - 42k in ChakraCore).

node and MongoDB are on the same machine (Windows 10 Home 64-bit). Tried to run it on a different machine (laptop) with Windows 7 Enterprise 64-bit, but node.exe ends immediately without any errors (node -v still shows v6.0.0-pre1).

jianchun commented 8 years ago

Thank you for checking this out and doing the tests! We will investigate the scenario you described. Indeed we have areas that need more work to improve performance.

I tried your "Simple TCP client-server scripts" on win7 x64 and didn't see the crash. So the crash was in mongoDB test? Please let us know if you found an easier repro.

morkai commented 8 years ago

There wasn't any crash. If a file is passed as the first argument, then it isn't executed. If no file is passed - the REPL is not started.

For example, given file hello.js:

console.log('Hello World!');

on Win10 machine I get:

C:\Workspace>"C:\Program Files\nodejs (chakracore)\nodevars.bat"
Your environment has been set up for using Node.js 6.0.0-pre1 (x64) and npm.

C:\Workspace>node -v
v6.0.0-pre1

C:\Workspace>node hello.js
Hello World!

C:\Workspace>

on Win7 machine:

C:\Workspace>"C:\Program Files\nodejs (chakracore)\nodevars.bat"
Your environment has been set up for using Node.js  and npm.

C:\Workspace>node -v
v6.0.0-pre1

C:\Workspace>node hello.js

C:\Workspace>
jianchun commented 8 years ago

What version of Win7 do you have? I'm on Windows 7 Enterprise Service Pack 1 and the hello.js example works.

C:\tmp>ver

Microsoft Windows [Version 6.1.7601]

C:\tmp>"c:\Program Files\nodejs (chakracore)\nodevars.bat"
Your environment has been set up for using Node.js 6.0.0-pre1 (x64) and npm.

C:\tmp>node -v
v6.0.0-pre1

C:\tmp>node hello.js
Hello World!
morkai commented 8 years ago

My Computer Properties shows Windows 7 Enterprise Service Pack 1 64-bit. ver shows Microsoft Windows [Version 6.1.7601].

It currently has:

It is a company laptop and has McAfee running (can't disable it).

kunalspathak commented 8 years ago

@morkai , Regading crash on Windows 7, similar issue was recently reported at Microsoft/chakracore#212 and was fixed with Microsoft/chakracore#202. Just to make sure that this is same issue, could you please confirm if your machine has IE11 installed?

morkai commented 8 years ago

No IE11 on the Windows 7 machine - only IE9.

kunalspathak commented 8 years ago

Thanks for confirming @morkai . The latest release should unblock you from using Node.js with chakracore on Windows 7 machine.

We are investigating the performance issue you reported and will update you on it.

kunalspathak commented 8 years ago

@morkai , after investigating this for sometime, it seems that the slowness in node+chakracore is happening because of JIT optimization that we don't do for arguments. See Microsoft/Chakracore#313 for details. I noticed some other areas in chakrashim that needs tweaking to improve performance.

On my dev machine, I was seeing approx. 68000 req/sec with node+v8. Before my changes mentioned above, node+chakracore was at 27000 req/sec. After my changes it boosted up to 44000 req/sec. I will continue my investigation in other gaps, but i think this is good starter point to catch up on TCP modules.

kfarnung commented 7 years ago

@kunalspathak Can we test the delta between node-v8 and node-chakracore?