ccxt: Why node js is slower than Python3.5?
I make ccxt as a restapi server, and I make a node and a python version.
node
- node v10.16.3
- server.js - https://github.com/epheien/ccxtjs/blob/master/server.js
- Dockerfile
FROM node:lts-alpine
WORKDIR /opt/ccxt-server
# Note: The directory itself is not copied, just its contents.
COPY server.js .
COPY node_modules ./node_modules
EXPOSE 12345
CMD ["node", "server.js", "0.0.0.0", "80"]
python
- python3.5
- ubuntu 16.04
- aiohttp or sanic
result
I test fetchOrderBook
delay with 30+ concurrent, and the delay of node is larger than the delay of Python 3.5.
As we all know, node can jit, but Python does not, why my node server is slower than Python?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (6 by maintainers)
At first glance, the speed is almost the same as the Python3 version. I’ll post some test results later.
Thanks your work.
Python 3.5.2 + aiohttp + uvloop
node v10.16.3 + node-fetch
Here are the latest test results
We can see that the latency of Python3 and node is similar.
This issue can be closed.
this bug should be fixed in #6302 )
I run this tests on node v12.10.0, the delay is almost unchanged, still a lot slower than Python.
Definitely use a more recent node version (over v12) as that includes a way faster http parsing lib: https://github.com/nodejs/node/issues/24730
you’re welcome. The issue was https://stackoverflow.com/questions/10895901/how-to-send-consecutive-requests-with-http-keep-alive-in-node-js if you are interested )
Of course yes.