Skip to content

Commit 8256400

Browse files
committed
Comment on Cost vs costFunc
1 parent 2aef60e commit 8256400

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

data/transactions/logic/eval.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,10 @@ func (cx *EvalContext) step() error {
907907

908908
opcost := deets.Cost
909909
if opcost == 0 {
910+
// We use a constant (deets.Cost) to avoid the cost of an indirect
911+
// function call in most cases. Consider getting the cost details into
912+
// OpSpec so that a single (inlinable?) function can compute the cost,
913+
// rather than a per opcode function pointer.
910914
opcost = deets.costFunc(cx.program, cx.pc)
911915
}
912916
if opcost == 0 {

0 commit comments

Comments
 (0)