Skip to content

Commit e16864b

Browse files
committed
WIP: add benchmarking for insertCoin
1 parent b12c894 commit e16864b

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

plutus-core/cost-model/budgeting-bench/Common.hs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,36 @@ createThreeTermBuiltinBenchWithWrappers (wrapX, wrapY, wrapZ) fun tys xs ys zs =
431431
[mkBM x y z | z <- zs] | y <- ys] | x <- xs]
432432
where mkBM x y z = benchDefault (showMemoryUsage (wrapZ z)) $ mkApp3 fun tys x y z
433433

434+
{- See Note [Adjusting the memory usage of arguments of costing benchmarks]. -}
435+
createFourTermBuiltinBenchElementwiseWithWrappers
436+
:: ( fun ~ DefaultFun
437+
, uni ~ DefaultUni
438+
, uni `HasTermLevel` a
439+
, uni `HasTermLevel` b
440+
, uni `HasTermLevel` c
441+
, uni `HasTermLevel` d
442+
, ExMemoryUsage a'
443+
, ExMemoryUsage b'
444+
, ExMemoryUsage c'
445+
, ExMemoryUsage d'
446+
, NFData a
447+
, NFData b
448+
, NFData c
449+
, NFData d
450+
)
451+
=> (a -> a', b -> b', c -> c', d -> d')
452+
-> fun
453+
-> [Type tyname uni ()]
454+
-> [(a,b,c,d)]
455+
-> Benchmark
456+
createFourTermBuiltinBenchElementwiseWithWrappers (wrapW, wrapX, wrapY, wrapZ) fun tys inputs =
457+
bgroup (show fun) $
458+
fmap
459+
(\(w, x, y, z) ->
460+
bgroup (showMemoryUsage $ wrapW w)
461+
[bgroup (showMemoryUsage $ wrapX x)
462+
[bgroup (showMemoryUsage $ wrapY y) [mkBM w x y z]]
463+
]
464+
)
465+
inputs
466+
where mkBM w x y z = benchDefault (showMemoryUsage $ wrapZ z) $ mkApp4 fun tys w x y z

plutus-core/cost-model/data/builtinCostModelA.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,5 +1205,25 @@
12051205
"arguments": 4,
12061206
"type": "constant_cost"
12071207
}
1208+
},
1209+
"insertCoin": {
1210+
"cpu": {
1211+
"arguments": 0,
1212+
"type": "constant_cost"
1213+
},
1214+
"memory": {
1215+
"arguments": 0,
1216+
"type": "constant_cost"
1217+
}
1218+
},
1219+
"unionValue": {
1220+
"cpu": {
1221+
"arguments": 0,
1222+
"type": "constant_cost"
1223+
},
1224+
"memory": {
1225+
"arguments": 0,
1226+
"type": "constant_cost"
1227+
}
12081228
}
12091229
}

0 commit comments

Comments
 (0)