Skip to content

feat: add factorial benchmark scenario#16

Merged
Unisay merged 6 commits intomainfrom
feature/factorial-benchmark
Aug 18, 2025
Merged

feat: add factorial benchmark scenario#16
Unisay merged 6 commits intomainfrom
feature/factorial-benchmark

Conversation

@Unisay
Copy link
Copy Markdown
Collaborator

@Unisay Unisay commented Aug 18, 2025

Summary

  • Add complete factorial benchmark scenario analogous to fibonacci
  • Add scenarios/factorial.md specification for factorial(10) = 3628800 target
  • Implement Factorial.hs module with recursive approach
  • Create complete Plinth_1.52.0.0_Unisay factorial submission
  • Replace redundant source file copies with README links to original source files
  • Re-generate report

Key Results

  • Target: factorial(10) = 3628800 ✅
  • CPU Units: 5,859,917
  • Memory Units: 21,751
  • All validations pass: Schema compliance, functional correctness

Files Added/Modified

scenarios/factorial.md                           # Benchmark specification
plinth/src/Factorial.hs                        # Haskell implementation  
plinth/app/Main.hs                             # Unified executable
submissions/factorial/Plinth_1.52.0.0_Unisay/ # Complete submission
└── source/README.md → ../../../../plinth/src/Factorial.hs

Test Plan

  • Built and tested: cabal run fibonacci generates both UPLC files
  • Verified correct output: factorial(10) = 3628800
  • Validated submission: All schema checks pass
  • Source links: README files link to original implementation
  • Code formatting: All files properly formatted

Related to https://github.com/IntersectMBO/plutus-private/issues/1758

Unisay added 4 commits August 18, 2025 09:53
Implement factorial benchmark analogous to fibonacci:
- Add factorial.md scenario specification
- Implement Factorial.hs module with factorial(10) = 3628800
- Add factorial executable in cabal project
- Test shows correct output and performance metrics

Related to plutus-private issue #1758
- Merge FactorialMain.hs into Main.hs to generate both fibonacci and factorial UPLC files
- Remove separate factorial executable from cabal file
- Single fibonacci executable now generates both benchmark files
- Verified both programs work correctly: fibonacci(25)=75025, factorial(10)=3628800
- Create complete factorial submission for Plinth 1.52.0.0
- factorial.uplc program computing factorial(10) = 3628800
- Performance metrics: 5.86M CPU units, 21.7K memory units
- All validation checks pass
- Source code included in submission
- Replace redundant Factorial.hs copy with README link to plinth/src/Factorial.hs
- Add README.md files to existing Plinth fibonacci submissions
- Use relative paths (../../../../plinth/src/) for GitHub navigation
- Eliminates duplicate source code maintenance
- Provides clear navigation to original implementation
@Unisay Unisay requested a review from Copilot August 18, 2025 08:06
@Unisay Unisay self-assigned this Aug 18, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a factorial benchmark scenario to the UPLC-CAPE benchmarking framework, complementing the existing fibonacci benchmark. The implementation provides a recursive factorial function that computes factorial(10) = 3628800, following the same patterns and structure as the existing fibonacci benchmark.

Key Changes:

  • Added factorial benchmark scenario specification and implementation
  • Created Factorial.hs module with recursive factorial algorithm
  • Generated complete submission with performance metrics and documentation

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scenarios/factorial.md Comprehensive specification document defining the factorial benchmark requirements, acceptance criteria, and submission guidelines
plinth/src/Factorial.hs Core factorial implementation using PlutusTx with recursive algorithm targeting factorial(10)
plinth/uplc-cape-benchmarks.cabal Updated library to expose the new Factorial module alongside existing Fibonacci module
plinth/app/Main.hs Modified main application to generate factorial.uplc output file in addition to fibonacci.uplc
submissions/factorial/Plinth_1.52.0.0_Unisay/* Complete benchmark submission including UPLC program, metadata, metrics, and documentation
submissions/fibonacci/*/source/README.md Added source code documentation for existing fibonacci submissions

Comment thread plinth/src/Factorial.hs
Unisay added 2 commits August 18, 2025 10:14
Remove explanations about what source code contains or does.
Keep only the reference link to the source file.
- Update timestamps to current measurement run
- Add standardized notes field for metrics generation
- Automated updates from measure tool execution
@Unisay Unisay merged commit 2da9090 into main Aug 18, 2025
1 check passed
@Unisay Unisay deleted the feature/factorial-benchmark branch August 18, 2025 08:20
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