Comparative Artifact Performance Evaluation for UPLC Programs
A standardized benchmarking framework for measuring and comparing the on-chain performance of UPLC programs generated by different Cardano smart contract compilers.
UPLC-CAPE provides a friendly competition platform for Cardano compiler authors to:
- ๐ Benchmark their compiler's UPLC output against standardized scenarios
- ๐ Compare performance across different compilers and versions
- ๐ Track optimization improvements over time
- ๐ Showcase efficient implementations to the community
Currently, comparing UPLC output from different compilers (Aiken, Plinth, Plutarch, etc.) is ad-hoc and inconsistent. UPLC-CAPE standardizes this process by providing:
- Consistent benchmarks - Well-defined computational scenarios
- Standardized metrics - CPU units, memory units, script size, term size
- Reproducible results - Version-controlled scenarios and submission metadata
- Community-driven - Open collaboration between compiler teams
- Nix with flakes enabled
- Git
# Clone the repository
git clone https://github.com/your-org/UPLC-CAPE.git
cd UPLC-CAPE
# Enter the development environment
nix develop
# Or if using direnv (recommended)
direnv allow
# Verify installation
cape --help# List available benchmarks
cape benchmark list
# View a specific benchmark
cape benchmark fibonacci
# Create a submission for your compiler
cape submission new fibonacci MyCompiler 1.0.0 myhandle| Benchmark | Type | Description | Status |
|---|---|---|---|
| Fibonacci | Synthetic | Recursive algorithm performance | โ Ready |
| Two-Party Escrow | Real-world | Smart contract scenario | ๐ง Planned |
| Streaming Payments | Real-world | Payment channel implementation | ๐ง Planned |
| Simple DAO Voting | Real-world | Governance mechanism | ๐ง Planned |
| Time-locked Staking | Real-world | Staking protocol | ๐ง Planned |
# Benchmark Management
cape benchmark list # List all benchmarks
cape benchmark list fibonacci # Show specific benchmark details
cape benchmark new my-benchmark # Create new benchmark
# Submission Management
cape submission list # List all submissions
cape submission list fibonacci # Show submissions for specific benchmark
cape submission new fibonacci Aiken 1.0.8 myhandle # Create new submission
cape submission validate # Validate submission files
cape submission validate --all # Validate all submissionsAll commands support interactive prompting for missing arguments:
# These will prompt for missing information
cape benchmark new # Prompts for benchmark name
cape submission new # Prompts for all required fields
cape submission new fibonacci # Prompts for compiler, version, handlecape --help # Show main help
cape benchmark --help # Show benchmark command help
cape submission new --help # Show specific subcommand helpcape benchmark listcape submission new fibonacci MyCompiler 1.0.0 myhandleThis creates: submissions/fibonacci/MyCompiler_1.0.0_myhandle/
Replace the placeholder with your compiled UPLC:
# Edit: submissions/fibonacci/MyCompiler_1.0.0_myhandle/fibonacci.uplc
# Your fully-applied UPLC program that computes fibonacci(25)Run your UPLC program and fill in the metrics:
# Edit: submissions/fibonacci/MyCompiler_1.0.0_myhandle/metrics.json
{
"cpu_units": 185916,
"memory_units": 592,
"script_size_bytes": 1234,
"term_size": 45
}Before submitting, validate your files against the required schemas:
# Validate your submission directory
cd submissions/fibonacci/MyCompiler_1.0.0_myhandle/
cape submission validate
# Or validate from project root
cape submission validate submissions/fibonacci/MyCompiler_1.0.0_myhandle/
# Validate specific files if needed
cape submission validate --single metrics.json
cape submission validate --single metadata.json# Edit: submissions/fibonacci/MyCompiler_1.0.0_myhandle/metadata.json
{
"compiler_name": "MyCompiler",
"compiler_version": "1.0.0",
"contributor_handle": "myhandle",
"submission_date": "2025-01-15",
"optimization_level": "O2"
}Edit the README.md with implementation notes, optimization strategies, and any relevant details.
UPLC-CAPE/
โโโ scenarios/ # Benchmark definitions
โ โโโ TEMPLATE/ # Template for new benchmarks
โ โโโ fibonacci.md # Fibonacci benchmark specification
โโโ submissions/ # Compiler submissions
โ โโโ TEMPLATE/ # Template for new submissions
โ โโโ fibonacci/ # Submissions for fibonacci benchmark
โ โโโ Aiken_1.0.8_contributor/ # Example submission
โโโ scripts/ # CAPE management tools
โ โโโ cape.sh # Main CLI tool
โ โโโ cape-subcommands/ # Command implementations
โโโ doc/ # Documentation
โ โโโ domain-model.md # Framework architecture
โ โโโ adr/ # Architecture Decision Records
โโโ templates/ # File templates
| Metric | Description | Measurement |
|---|---|---|
| CPU Units | Computational cost for execution | CEK machine steps |
| Memory Units | Memory consumption during execution | CEK machine memory |
| Script Size | Size of the compiled UPLC script | Bytes |
| Term Size | Size of the UPLC term | AST nodes |
We welcome contributions from compiler authors, benchmark designers, and performance researchers!
# Create benchmark specification
cape benchmark new my-new-benchmark
# Edit the generated file
nano scenarios/my-new-benchmark.md
# Submit a pull request# Create submission for existing benchmark
cape submission new existing-benchmark MyCompiler 1.0.0 myhandle
# Fill in your UPLC program and metrics
# Submit a pull request- ๐ Contributing Guide - Detailed contribution process
- ๐๏ธ Domain Model - Framework architecture
- ๐ Templates - File templates and examples
When contributing to this project:
- Enter the development environment:
nix develop - Check existing ADRs to understand current architectural decisions
- Create an ADR for any significant architectural changes:
adr new "Your Decision" - Follow the established patterns and guidelines documented in the ADRs
This project uses Nix for reproducible development environments:
# Enter the development shell
nix develop
# Or if using direnv (recommended)
direnv allow
# Available tools:
cape <command> # CAPE management tool
adr new "Title" # Create Architecture Decision Record
mmdc -i file.mmd # Generate diagrams# Test the CLI tool
cape benchmark list
cape submission list
# Run tests (if available)
just testThis project uses Architecture Decision Records to document important architectural and design decisions. ADRs are managed using Log4brains.
The development environment includes convenient short commands for managing ADRs:
# Create a new ADR
adr new "My Decision Title"
# Preview ADRs in your browser
adr preview
# Build static documentation site
adr build
# Show help and available commands
adr helpFor even faster usage, single letter aliases are available:
adr n "Quick ADR" # new
adr p # preview
adr b # build
adr h # help- Before making significant decisions: Check existing ADRs in
doc/adr/ - When making a new decision: Create an ADR using
adr new "Decision Title" - Follow the template: Fill out Context, Decision, and Consequences sections
- Review process: Use
adr previewto review your ADR in the browser - Commit: Include the ADR in your pull request with the related changes
- ๐๏ธ Domain Model - Framework architecture and entities
- ๐ Contributing Guide - How to contribute
- ๐ฏ Project Epic - Detailed project description and goals
- ๐ Benchmark Specifications - Individual benchmark details
- ๐ฌ Discussions - Use GitHub Discussions for questions
- ๐ Issues - Report bugs via GitHub Issues
- ๐ง Contact - Reach out to the Plutus Core team
We invite all Cardano compiler teams to participate:
- Aiken - Modern smart contract language
- Plinth - Reference implementation
- Plutarch - High-level eDSL
- Your Compiler - Join the friendly competition!
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Plutus Core Team - Framework infrastructure and reference implementations
- Compiler Authors - For participating in the friendly competition
- Community Contributors - For benchmark scenarios and improvements
- Log4brains Documentation - ADR tool documentation
- Architecture Decision Records - ADR concept by Michael Nygard
Ready to benchmark your compiler? ๐