Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pricegraph: Store order remaining amount and user balances as integers (
#1417) instead of floats. While working on a using a BigRational type for ExchangeRate in a different branch I noticed that this change also makes sense and could be refactored it into its own PR. With the BigRational change Flow::capacity and min_trade would also become u128s. Benchmark <details>Pricegraph::read time: [5.6543 ms 5.6597 ms 5.6654 ms] change: [-0.6112% -0.4534% -0.2954%] (p = 0.00 < 0.05) Change within noise threshold. Pricegraph::transitive_orderbook/5298183 time: [5.5705 ms 5.5748 ms 5.5794 ms] change: [+0.7394% +0.8957% +1.0439%] (p = 0.00 < 0.05) Change within noise threshold. Pricegraph::estimate_limit_price/100000000000000000 time: [47.531 us 47.607 us 47.670 us] change: [+8.3493% +8.4750% +8.5964%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/1000000000000000000 time: [48.837 us 48.874 us 48.922 us] change: [+1.8688% +2.1218% +2.3802%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/10000000000000000000 time: [94.161 us 94.197 us 94.240 us] change: [+2.0211% +2.2254% +2.4099%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/100000000000000000000 time: [192.46 us 192.72 us 193.05 us] change: [+1.5835% +1.8608% +2.0939%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/1000000000000000000000 time: [477.25 us 477.63 us 478.07 us] change: [+7.6418% +7.8084% +7.9628%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/200 time: [42.607 us 42.744 us 42.921 us] change: [+4.3753% +4.8784% +5.4368%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/190 time: [122.03 us 122.29 us 122.61 us] change: [+1.9331% +2.3399% +2.6983%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/180 time: [208.11 us 208.35 us 208.58 us] change: [+2.1229% +2.5886% +3.0075%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/150 time: [452.56 us 452.84 us 453.11 us] change: [+2.9362% +3.0678% +3.1991%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/100 time: [509.79 us 510.08 us 510.46 us] change: [+6.5567% +6.7537% +6.9483%] (p = 0.00 < 0.05) Performance has regressed. </details> Benchmark now with balance as U256 <details> Pricegraph::read time: [5.9581 ms 5.9664 ms 5.9754 ms] change: [+2.0925% +2.6443% +3.1203%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::transitive_orderbook/5298183 time: [5.8476 ms 5.8520 ms 5.8571 ms] change: [+2.1179% +2.6124% +3.0897%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/100000000000000000 time: [47.819 us 47.846 us 47.873 us] change: [+8.1399% +8.8444% +9.4816%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/1000000000000000000 time: [49.410 us 49.513 us 49.632 us] change: [+1.9095% +2.8321% +3.6865%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/10000000000000000000 time: [96.026 us 96.119 us 96.240 us] change: [+1.8636% +2.7113% +3.3794%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::estimate_limit_price/100000000000000000000 time: [197.57 us 197.73 us 197.95 us] change: [-0.4474% +0.8413% +2.0184%] (p = 0.18 > 0.05) No change in performance detected. Pricegraph::estimate_limit_price/1000000000000000000000 time: [488.48 us 489.17 us 490.14 us] change: [+7.3693% +8.1000% +8.7454%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/200 time: [41.826 us 41.905 us 42.000 us] change: [+3.6122% +4.2047% +4.7273%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/190 time: [121.74 us 121.89 us 122.08 us] change: [-1.0053% -0.2611% +0.3924%] (p = 0.48 > 0.05) No change in performance detected. Pricegraph::order_for_limit_price/180 time: [213.23 us 213.31 us 213.41 us] change: [+0.1689% +1.2980% +2.2842%] (p = 0.01 < 0.05) Change within noise threshold. Pricegraph::order_for_limit_price/150 time: [464.76 us 465.16 us 465.65 us] change: [+5.2298% +5.4621% +5.6739%] (p = 0.00 < 0.05) Performance has regressed. Pricegraph::order_for_limit_price/100 time: [521.98 us 522.61 us 523.40 us] change: [+8.5424% +8.7334% +8.9668%] (p = 0.00 < 0.05) Performance has regressed. </details> ### Test Plan Existing unit tests.
- Loading branch information