diff --git a/report/benchmarks/factorial.html b/report/benchmarks/factorial.html index caf70754..1eefe9bc 100644 --- a/report/benchmarks/factorial.html +++ b/report/benchmarks/factorial.html @@ -150,7 +150,7 @@

🚀 UPLC-CAPE Performance Report - factorial

- Generated on: 2025-08-18 18:56:34 CEST + Generated on: 2025-08-20 00:56:44 CDT
@@ -193,7 +193,7 @@

📋 Performance Data

- 2025-08-18T16:56:26Z + 2025-08-20T05:56:42Z Plinth 1.52.0.0 Unisay diff --git a/report/benchmarks/fibonacci.html b/report/benchmarks/fibonacci.html index ff341e8d..30fabb11 100644 --- a/report/benchmarks/fibonacci.html +++ b/report/benchmarks/fibonacci.html @@ -150,7 +150,7 @@

🚀 UPLC-CAPE Performance Report - fibonacci

- Generated on: 2025-08-18 18:56:36 CEST + Generated on: 2025-08-20 00:56:45 CDT
@@ -193,7 +193,7 @@

📋 Performance Data

- 2025-08-18T16:56:26Z + 2025-08-20T05:56:42Z Plinth 1.49.0.0 Unisay @@ -204,7 +204,7 @@

📋 Performance Data

🔗 - 2025-08-18T16:56:26Z + 2025-08-20T05:56:42Z Plinth 1.52.0.0 Unisay @@ -215,7 +215,7 @@

📋 Performance Data

🔗 - 2025-08-18T16:56:26Z + 2025-08-20T05:56:42Z Aiken 1.1.17 KtorZ @@ -225,6 +225,17 @@

📋 Performance Data

81 🔗 + + 2025-08-20T05:56:42Z + Plutarch + 1.10.1 + Seungheon Oh + 159193455218 + 583897822 + 50 + 43 + 🔗 +
diff --git a/report/benchmarks/images/factorial_cpu_units.png b/report/benchmarks/images/factorial_cpu_units.png index b6234453..e7c8d321 100644 Binary files a/report/benchmarks/images/factorial_cpu_units.png and b/report/benchmarks/images/factorial_cpu_units.png differ diff --git a/report/benchmarks/images/factorial_memory_units.png b/report/benchmarks/images/factorial_memory_units.png index 0679cab1..aacb18f7 100644 Binary files a/report/benchmarks/images/factorial_memory_units.png and b/report/benchmarks/images/factorial_memory_units.png differ diff --git a/report/benchmarks/images/factorial_script_size.png b/report/benchmarks/images/factorial_script_size.png index ec487f67..4980eadb 100644 Binary files a/report/benchmarks/images/factorial_script_size.png and b/report/benchmarks/images/factorial_script_size.png differ diff --git a/report/benchmarks/images/factorial_term_size.png b/report/benchmarks/images/factorial_term_size.png index 55456b38..c2008fa3 100644 Binary files a/report/benchmarks/images/factorial_term_size.png and b/report/benchmarks/images/factorial_term_size.png differ diff --git a/report/benchmarks/images/fibonacci_cpu_units.png b/report/benchmarks/images/fibonacci_cpu_units.png index c773c73a..e46729c6 100644 Binary files a/report/benchmarks/images/fibonacci_cpu_units.png and b/report/benchmarks/images/fibonacci_cpu_units.png differ diff --git a/report/benchmarks/images/fibonacci_memory_units.png b/report/benchmarks/images/fibonacci_memory_units.png index 21aa1a2d..efc64027 100644 Binary files a/report/benchmarks/images/fibonacci_memory_units.png and b/report/benchmarks/images/fibonacci_memory_units.png differ diff --git a/report/benchmarks/images/fibonacci_script_size.png b/report/benchmarks/images/fibonacci_script_size.png index 91482389..9ed5a812 100644 Binary files a/report/benchmarks/images/fibonacci_script_size.png and b/report/benchmarks/images/fibonacci_script_size.png differ diff --git a/report/benchmarks/images/fibonacci_term_size.png b/report/benchmarks/images/fibonacci_term_size.png index 4f3796d8..5337c24a 100644 Binary files a/report/benchmarks/images/fibonacci_term_size.png and b/report/benchmarks/images/fibonacci_term_size.png differ diff --git a/report/index.html b/report/index.html index 4c380410..84c9afc5 100644 --- a/report/index.html +++ b/report/index.html @@ -85,7 +85,7 @@

🚀 UPLC-CAPE Performance Reports

- Generated on: 2025-08-18 18:56:36 CEST + Generated on: 2025-08-20 00:56:45 CDT
diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/README.md b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/README.md new file mode 100644 index 00000000..371cc77b --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/README.md @@ -0,0 +1,27 @@ +# Benchmark Implementation Notes + +**Scenario**: `fibonacci` + +**Submission ID**: `Plutarch_1.10.1_SeungheonOh` + +## Implementation Details + +- **Compiler**: `Plutarch v1.10.1` +- **Implementation Approach**: `recursive` +- **Compilation Flags**: N/A + +## Performance Results + +- See [metrics.json](metrics.json) for detailed performance measurements + +## Reproducibility + +- **Source Available**: true +- **Source Repository**: N/A +- **Compilation Config**: describe any non-default parameters + +## Notes + +I provided two different fix point combinator: `pfix'` and `pfix''`. They have different performance +trade offs. `pfix'` will generate smaller script with bigger CPU and Memory cost while `pfix''` will +generate bigger script(in terms of size) with smaller CPU and Memory cost. diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/config.json b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/config.json new file mode 100644 index 00000000..3f56e0d6 --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/config.json @@ -0,0 +1,6 @@ +{ + "comment": "Optional: Include compilation parameters that affect UPLC output", + "optimization_flags": [], + "compiler_settings": {}, + "build_environment": {} +} diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/fibonacci.uplc b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/fibonacci.uplc new file mode 100644 index 00000000..b1044523 --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/fibonacci.uplc @@ -0,0 +1,40 @@ +(program + 1.1.0 + [ + [ + (lam i-0 [ i-0 i-0 ]) + (lam + i-1 + (lam + i-2 + (force + (case + (constr + 0 + [ [ (builtin lessThanEqualsInteger) i-2 ] (con integer 1) ] + (delay i-2) + (delay + [ + [ + (builtin addInteger) + [ + [ i-1 i-1 ] + [ [ (builtin subtractInteger) i-2 ] (con integer 1) ] + ] + ] + [ + [ i-1 i-1 ] + [ [ (builtin subtractInteger) i-2 ] (con integer 2) ] + ] + ] + ) + ) + (force (builtin ifThenElse)) + ) + ) + ) + ) + ] + (con integer 25) + ] +) \ No newline at end of file diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/metadata.json b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/metadata.json new file mode 100644 index 00000000..0f131e14 --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/metadata.json @@ -0,0 +1,27 @@ +{ + "compiler": { + "name": "Plutarch", + "version": "1.10.1", + "commit_hash": "75c06ef1e77742916574414975f76ddac59cce4a" + }, + "compilation_config": { + "optimization_level": "Plutarch", + "target": "uplc", + "flags": ["Plutarch"], + "environment": { + "dependencies": { + "plutarch": "1.10.1" + } + } + }, + "contributor": { + "name": "Seungheon Oh", + "organization": "IOG", + "contact": "seungheon.oh@iohk.io" + }, + "submission": { + "date": "2025-08-19T00:00:00Z", + "source_available": true, + "implementation_notes": "Plutarch" + } +} diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/metrics.json b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/metrics.json new file mode 100644 index 00000000..54162fea --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/metrics.json @@ -0,0 +1,15 @@ +{ + "execution_environment": { + "evaluator": "PlutusTx.Eval-unknown" + }, + "measurements": { + "cpu_units": 159193455218, + "memory_units": 583897822, + "script_size_bytes": 50, + "term_size": 43 + }, + "notes": "", + "scenario": "fibonacci", + "timestamp": "2025-08-20T05:56:42Z", + "version": "1.0.0" +} diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/source/.gitkeep b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/source/.gitkeep new file mode 100644 index 00000000..d3d21c73 --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/source/.gitkeep @@ -0,0 +1 @@ +# Optional: Place your source code files here diff --git a/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/source/fibo.hs b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/source/fibo.hs new file mode 100644 index 00000000..0961ac33 --- /dev/null +++ b/submissions/fibonacci/Plutarch_1.10.1_SeungheonOh/source/fibo.hs @@ -0,0 +1,35 @@ +module Main where + +import Control.Lens (traverseOf) +import Plutarch.Prelude +import Plutarch.Internal.Term (compile, punsafeCoerce) +import Plutarch.Script +import PlutusCore.Pretty +import UntypedPlutusCore (programMapNames, fakeNameDeBruijn, progTerm, unDeBruijnTerm) +import PlutusCore (runQuoteT, FreeVariableError) + +-- this is faster than `Plutarch.Internal.Fix.pfix`. +pfix' :: (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) +pfix' f = + (plam $ \r -> (punsafeCoerce r) # r) # + (plam $ \r -> f ((punsafeCoerce r) # r)) + +-- this is faster than `pfix'` but generates more bloat uplc. +pfix'' :: (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) +pfix'' f = + (plam $ \r -> f ((punsafeCoerce r) # r)) # + (plam $ \r -> f ((punsafeCoerce r) # r)) + +pfibo :: Term s (PInteger :--> PInteger) +pfibo = + pfix' $ \r -> plam $ \x -> + pif (x #<= 1) x (r # (x - 1) + r # (x - 2)) + +main :: IO () +main = + case compile mempty $ pfibo # 25 of + Left _ -> error "compiliation failed" + Right (Script s) -> + case runQuoteT $ traverseOf progTerm unDeBruijnTerm $ programMapNames fakeNameDeBruijn s of + Left (_ :: FreeVariableError) -> error "debruijn conversion failed" + Right s' -> print $ prettyPlcClassic s'