[PERF] - Performance issues with functions using toLedgerPParams
in cardano-api
#4622
Labels
comp: cardano-api
Stale
type: enhancement
An improvement on the existing functionality
user type: internal
Created by an IOG employee
Internal/External
Internal
Area
Other
Summary
We noticed some significant performance issues with
Cardano.Api.Fees.evaluateTransactionFee
andCardano.Api.TxBody.makeTransactionBody
. After profiling the code, we noticed that the reason was because the functions would convertCardano.Api.ProtocolParameters
to cardano-ledger'sPParams
every time we call one of the functions. However, the conversion between the two datatypes take s a significant amount of time because of a plutus-core function (applyCostModelParams ) when creating the cost model.Steps to reproduce
Steps to reproduce the behavior:
toLedgerPParams
such asmakeTransactionBody
andevaluateTransactionFee
.Expected behavior
I'm expecting that the conversion between cardano-api's ProtocolParameter and cardano-ledger's PParams does not require significant computation.
Even better, I think we should probably not have a different datatype for protocol parameters as we already have one in cardano-ledger. Why not create a wrapper on top of it instead of defining a different data type?
System info (please complete the following information):
Screenshots and attachments
Here are some profiling results of the problematic functions:
Additional context
None
The text was updated successfully, but these errors were encountered: