Replies: 2 comments 1 reply
-
I assume you're using node.js. Even if your system has multiple cores, node.js does not use them by default. You have to write code that spin ups multiple worker threads (child processes) to get stuff done in parallel. If you want to maximise single-core performance to a competing level, javascript/nodejs might not be best as in your game i.e. trading, your opponents might be using systems written in Rust or Golang which would give them an advantage over you. |
Beta Was this translation helpful? Give feedback.
-
There isn’t anything inherent in ethers that will limit transaction signing. It RLP encodes the values, hashes it, signs the hash and then re-RLP encodes the values with the signature. Those are really the minimal steps possible. A faster CPU should increase the speed, but as @zemse pointed out, if you are just adding more cores, that won’t affect node.js. If you need more performance, you could use something other than JavaScript, or build a custom library that modifies the RLP-coded data in-place (if most the tx remains the same), which would be non-trivial and might get some extra speed, but I think ECC is likely the bottleneck. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I just started working with the ethers.js library recently but one thing I have noticed is that each time I need to build and sign a new tx, it takes around 10ms to do so !
For high performance trading this is quite a significant delay, which makes me think the best approach is to prebuild and presign the txs whenever possible .
There are however times at which the transaction details are unkown , so building and signing a new tx is the only possible solution .
Is there any way to reduce the time it takes to build and sign a tx ? I thought by increasing cpu power I would see some performance gains, as tx signing is supposed to use ECDSA algorithm which has a direct correlation to cpu power, but curiously I was not able to notice any performance gains between a VPS and a dedicated server with a very good cpu .
Is this an inherent limitation of the ethers.js library ? 10 ms is a lot of time, especially when processing multiple transactions sequentially .
Thanks
Beta Was this translation helpful? Give feedback.
All reactions