hiero-ledger / hiero-ledger/hiero-consensus-node
Optimize FeeCalculatorImpl construction
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
Finding from @jasperpotts:
> Here is one I have found that could be investigated, it seems we create a lot of Fee Calculators and the constructor is expensive. For example it converts PBJ and GRPC objects every time. It is not massive percentage but feels like it should be possible to make it less expensive.
> `com.hedera.node.app.fees.FeeCalculatorImpl#FeeCalculatorImpl(com.hedera.hapi.node.transaction.TransactionBody, com.hedera.hapi.node.base.Key, int, int, com.hedera.hapi.node.base.FeeData, com.hedera.hapi.node.transaction.ExchangeRate, boolean, com.hedera.node.app.fees.congestion.CongestionMultipliers, com.hedera.node.app.workflows.dispatcher.ReadableStoreFactory)`
> It is called from 84 places via
> `com.hedera.node.app.workflows.handle.HandleContextImpl#feeCalculator`
Contributor guide
Research direction
Start by reading com.hedera.node.app.fees.FeeCalculatorImpl#FeeCalculatorImpl and the feeCalculator method in com.hedera.node.app.workflows.handle.HandleContextImpl, then trace representative callers. Identify which PBJ and GRPC conversions are repeated during construction and reduce that cost without changing fee-calculation behavior. Done means the constructor is measurably less expensive while all existing behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100