comunica / sparqlee

⚙️ SPARQL expression evaluator library - Moved to @comunica/expression-evaluator
https://www.npmjs.com/package/sparqlee
14 stars 7 forks source link

Swaps decimal.js for bignumber.js to lower bundle size #130

Closed jacoscaz closed 2 years ago

jacoscaz commented 2 years ago

This PR replaces decimal.js (32 KB) with bignumber.js (20 KB) to lower bundle size. The minimal changes required to make this happen made this a very low-hanging fruit.

A further step along the same direction would be to use either big.js (8 KB) or decimal.js-light (6 KB). However, doing so requires more work to handle edge cases involving Infinity, NaN and -0 as these are not supported by the smaller libraries.

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 89.54% when pulling c394644f98afa1ba87ef862eaf4f0cd24eb694a1 on jacoscaz:bignumber.js into 58befd26bcb416a5278efd8b0febff8ecd99d7d9 on comunica:master.

jacoscaz commented 2 years ago

Actually, there's also bn.js which I had missed.

jacoscaz commented 2 years ago

Another alternative: https://github.com/GoogleChromeLabs/jsbi .

For the time being I'll keep the PR as-is and go with bignumber.js. Anything else requires more work.

jacoscaz commented 2 years ago

Yup, all tests are passing.

rubensworks commented 2 years ago

Great, thanks!