Skip to content

Cost model for assetCount (CIP-0168) - #7918

Open
Unisay wants to merge 1 commit into
masterfrom
yura/issue-2312-assetcount-costing
Open

Cost model for assetCount (CIP-0168)#7918
Unisay wants to merge 1 commit into
masterfrom
yura/issue-2312-assetcount-costing

Conversation

@Unisay

@Unisay Unisay commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Benchmarks the builtin over 101 values and adds the two resulting parameters to the cost model record, the five JSON variants and the ledger API parameter lists. The builtin itself landed in #7912; this gives it a cost model in place of unimplementedCostingFun.

The model is a constant: across sizes 0 to 31153 the measured time stays within 2%.

This discharges the condition CIP-0168 places on the builtin. The derived alternative starts with valueData at 38159ps per asset, before the unsafeDataAsMap and list walk it also needs, so there is no size at which it is cheaper.

Closes IntersectMBO/plutus-private#2312.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.6.3

🚀 View preview at
https://IntersectMBO.github.io/plutus/pr-preview/cost-models/pr-7918/

Built to branch gh-pages at 2026-08-21 14:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@Unisay

Unisay commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author
image

@Unisay Unisay self-assigned this Aug 21, 2026
@Unisay
Unisay force-pushed the yura/issue-2312-assetcount-costing branch from d1ce52d to 9642f93 Compare August 21, 2026 12:47
Benchmarks the builtin over 101 values and adds the two resulting
parameters to the cost model record, the JSON variants and the ledger API
parameter lists.

The model is a constant. Measured across sizes 0 to 31153 the time stays
within 2%, which is what reading a maintained field predicts.

This discharges the condition CIP-0168 places on the builtin: the derived
alternative starts with `valueData` at 38159ps per asset, before the
`unsafeDataAsMap` and list walk it also needs, so there is no size at
which it is cheaper.

Also groups the `TestCostModels` entries by feature area rather than by
batch, which is what the rest of that list does: `multiIndexArray` moves
into the existing Arrays group and the two batch-7 trailers go away.

Closes IntersectMBO/plutus-private#2312.
@Unisay
Unisay force-pushed the yura/issue-2312-assetcount-costing branch from 9642f93 to d275fea Compare August 21, 2026 13:24
@Unisay
Unisay requested a review from kwxm August 21, 2026 15:11
@Unisay Unisay added Builtins Costing Anything relating to costs, fees, gas, etc. labels Aug 21, 2026
@Unisay
Unisay marked this pull request as ready for review August 21, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Builtins Costing Anything relating to costs, fees, gas, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant