Skip to content

Conversation

ana-pantilie
Copy link
Contributor

@ana-pantilie ana-pantilie commented Sep 16, 2025

Needs #7344

Copy link
Contributor

PR Preview Action v1.6.2

🚀 View preview at
https://IntersectMBO.github.io/plutus/pr-preview/pr-7337/

Built to branch gh-pages at 2025-09-16 15:43 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ana-pantilie ana-pantilie self-assigned this Sep 16, 2025
@ana-pantilie ana-pantilie force-pushed the ana/insertCoin-unionValue-costing branch from b893323 to 3c5708d Compare October 1, 2025 11:32
@ana-pantilie ana-pantilie changed the title WIP: insertCoin and unionValue costing BuiltinValue: deleteCoin, insertCoin and unionValue costing Oct 1, 2025
@ana-pantilie ana-pantilie changed the title BuiltinValue: deleteCoin, insertCoin and unionValue costing BuiltinValue: insertCoin and unionValue costing Oct 1, 2025
Unisay added 5 commits October 1, 2025 16:28
Extends the cost modeling framework to support lookupCoin, valueContains,
valueData, and unValueData builtins. Adds parameter definitions, arity
specifications, and integrates with the cost model generation system.

Establishes foundation for accurate costing of Value operations in
Plutus Core execution.
Creates Values.hs benchmark module with systematic test generation
for lookupCoin, valueContains, valueData, and unValueData operations.
Includes value generation utilities, individual benchmark functions,
and edge case testing with empty values.

Enables data collection for accurate cost model parameter fitting.
Implements optimal statistical models for Value operations based on
performance characteristics: linear models for lookupCoin and valueContains
(size-dependent), constant model for valueData (uniform performance),
and linear model for unValueData.

Provides accurate cost parameters across all builtin cost model
configurations and updates test expectations.
Removes unimplementedCostingFun placeholders for Value builtins and
connects them to their respective cost model parameters (paramLookupCoin,
paramValueContains, paramValueData, paramUnValueData).

Enables accurate execution cost calculation for Value operations in
Plutus Core scripts.
Includes extensive benchmark results covering various input sizes and
edge cases for lookupCoin, valueContains, valueData, and unValueData.
Data validates the chosen statistical models and cost parameters.

Provides empirical foundation confirming model accuracy across
different operation profiles.
@ana-pantilie ana-pantilie force-pushed the ana/insertCoin-unionValue-costing branch 2 times, most recently from 2a7f6ca to 0d420fe Compare October 1, 2025 15:11
Unisay and others added 3 commits October 2, 2025 11:43
Add a new Logarithmic newtype wrapper in ExMemoryUsage that transforms
size measures logarithmically. This enables linear cost models to
effectively capture O(log n) runtime behavior by measuring log(size)
instead of size directly.

The wrapper computes max(1, floor(log2(size) + 1)) from any wrapped
ExMemoryUsage instance, making it composable with existing size measures
like ValueOuterOrMaxInner for operations with logarithmic complexity.

This infrastructure supports proper costing of Value builtins like
lookupCoin which has O(log max(m, k)) complexity.
Refactor the Value benchmarking suite to use Cardano-compliant key sizes
(32-byte max) and leverage the new Logarithmic wrapper for accurate
modeling of logarithmic operations.

Key changes:
- Apply Logarithmic wrapper to lookupCoin and valueContains benchmarks
  for proper O(log n) cost modeling
- Consolidate key generators from 4 functions to 2, eliminating duplication
- Remove obsolete key size parameters throughout (keys always maxKeyLen)
- Extract withSearchKeys pattern to eliminate repetitive code
- Simplify test generation by removing arbitrary key size variations
- Clean up lookupCoinArgs structure for better readability

The refactoring reduces the module from 359 to 298 lines while improving
clarity and ensuring all generated Values comply with Cardano's 32-byte
key length limit.
@ana-pantilie ana-pantilie force-pushed the ana/insertCoin-unionValue-costing branch from 0d420fe to 75bd7a5 Compare October 6, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants