port(gas_price_service): bring optimizations from 0.40.4 for cumulative_pct_change to master #2645
+744
−35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked Issues/PRs
Description
This pull request includes changes to the
fuel-core
service to refactor and improve the handling of gas price calculations. The most important changes involve moving thecumulative_percentage_change
function to a more appropriate module and updating the relevant imports accordingly.Refactoring and code organization:
crates/fuel-core/src/service/adapters.rs
: Removed thecumulative_percentage_change
function and updated the import to use the function from thefuel_core_gas_price_service
module. [1] [2]crates/fuel-gas-price-algorithm/src/lib.rs
: Added a public re-export for thecumulative_percentage_change
function.crates/services/gas_price_service/src/common.rs
: Added a public re-export for thecumulative_percentage_change
function from thefuel_gas_price_algorithm
module.Perf improvements
ROUNDING_ERROR_COMPENSATION
calc by comparing asm generated with-C opt-level=3
previous asm for ROUNDING_ERROR_COMPENSATION:
new asm for ROUNDING_ERROR_COMPENSATION:
Checklist
Before requesting review