web3 / web3.js

Collection of comprehensive TypeScript libraries for Interaction with the Ethereum JSON RPC API and utility functions.
https://web3js.org/
Other
19.17k stars 4.91k forks source link

Stop relying on BigNumber #331

Closed frozeman closed 8 years ago

frozeman commented 8 years ago

It seems that in my dapps BigNumber is a big resource killer and seems very slow, so reming this would probably speed up outputFormatters a lot. And then the dapp developer can only connect the wei numbers he needs..

@marek what do you think of removing the BigNumber dependency and returning wei values always as hex and leave the conversion to the user?

debris commented 8 years ago

It's related to #322. Removing BigNumber dependency is not an option, cause we use it also in many other places - eg. formatting solidity input/output params, formatting transaction value and so on... Also I don't see why returning hex values would be resource killer. Encoding/decoding solidity input params is much more inefficient right now and if anything works slow, that's the place where we should look for optimisations.

frozeman commented 8 years ago

If you receive a lot of blocks and transactions, where some properties will be auto converted to BigNumber objects, iI noticed visible interface lags. Looking at the timeline panel of chrome seems like its the BigNumber conversion mainly.

Concerning the internally usage I think thats actually not so good as it produces weird errors sometimes, which are untraceable/understandable for users. I also believe there are better libraries out there for this purpose.

I would like to keep this issue open for discussion.