Skip to content

Conversation

@SeungheonOh
Copy link
Collaborator

@SeungheonOh SeungheonOh commented Jul 7, 2025

For Cek, we intentionally maintain ambiguity of the annotation type for performance reasons(I assume). This PR makes it so that this ambiguity is forcefully enforced by using GHC.Exts.Any as the annotation type. This reduces some noise on the types while also allowing construction of UPLC nodes within CEK in nicer way, which is what I needed for this

SteppableCek is a bit messy because its context can hold annotations, so it would require more coercsions.

@SeungheonOh
Copy link
Collaborator Author

SeungheonOh commented Jul 7, 2025

/benchmark lists

it shouldn't differ really. core didn't change

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2025

Click here to check the status of your benchmark.

@SeungheonOh SeungheonOh requested a review from effectfully July 8, 2025 00:00
forgetAnn :: forall ann uni fun. NTerm uni fun ann -> NTerm uni fun Any
forgetAnn = unsafeCoerce

rememberAnn :: forall ann uni fun. NTerm uni fun Any -> NTerm uni fun ann
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is unsafe

Starting term -> pure $ Computing NoFrame Env.empty term
Computing ctx env term -> computeCek ctx env term
Starting term -> pure $ Computing NoFrame Env.empty (forgetAnn term)
Computing ctx env term -> computeCek ctx env (rememberAnn term)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is only safe if Computing ... is constructed by cekTrans which is not ideal. Probably, it is possible to have some witness value to allow this conditionally

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2025

PR Preview Action v1.6.2

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

Built to branch gh-pages at 2025-07-08 00:10 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2025

Comparing benchmark results of 'lists' on 'f0aca4d2d' (base) and '677517527' (PR)

Results table
Script f0aca4d 6775175 Change
sort/ghcSort/50 137.3 μs 134.4 μs -2.1%
sort/ghcSort/100 315.2 μs 310.4 μs -1.5%
sort/ghcSort/150 544.6 μs 535.0 μs -1.8%
sort/ghcSort/200 732.4 μs 715.9 μs -2.3%
sort/ghcSort/250 954.5 μs 929.1 μs -2.7%
sort/ghcSort/300 1.247 ms 1.220 ms -2.2%
sort/insertionSort/50 427.4 μs 422.9 μs -1.1%
sort/insertionSort/100 1.728 ms 1.694 ms -2.0%
sort/insertionSort/150 3.910 ms 3.825 ms -2.2%
sort/insertionSort/200 6.946 ms 6.819 ms -1.8%
sort/insertionSort/250 10.93 ms 10.67 ms -2.4%
sort/insertionSort/300 15.78 ms 15.46 ms -2.0%
sort/mergeSort/50 430.4 μs 423.5 μs -1.6%
sort/mergeSort/100 985.2 μs 970.7 μs -1.5%
sort/mergeSort/150 1.595 ms 1.573 ms -1.4%
sort/mergeSort/200 2.233 ms 2.200 ms -1.5%
sort/mergeSort/250 2.943 ms 2.886 ms -1.9%
sort/mergeSort/300 3.578 ms 3.527 ms -1.4%
sort/quickSort/50 1.072 ms 1.055 ms -1.6%
sort/quickSort/100 4.525 ms 4.470 ms -1.2%
sort/quickSort/150 10.18 ms 10.04 ms -1.4%
sort/quickSort/200 18.10 ms 17.83 ms -1.5%
sort/quickSort/250 28.47 ms 28.13 ms -1.2%
sort/quickSort/300 41.05 ms 40.41 ms -1.6%
sum/compiled-from-Haskell/sum-right-builtin/100 81.78 μs 79.95 μs -2.2%
sum/compiled-from-Haskell/sum-right-builtin/500 428.0 μs 421.7 μs -1.5%
sum/compiled-from-Haskell/sum-right-builtin/1000 920.8 μs 908.5 μs -1.3%
sum/compiled-from-Haskell/sum-right-builtin/2500 2.819 ms 2.786 ms -1.2%
sum/compiled-from-Haskell/sum-right-builtin/5000 6.149 ms 6.042 ms -1.7%
sum/compiled-from-Haskell/sum-right-Scott/100 45.48 μs 44.79 μs -1.5%
sum/compiled-from-Haskell/sum-right-Scott/500 241.1 μs 238.0 μs -1.3%
sum/compiled-from-Haskell/sum-right-Scott/1000 527.8 μs 523.4 μs -0.8%
sum/compiled-from-Haskell/sum-right-Scott/2500 1.864 ms 1.844 ms -1.1%
sum/compiled-from-Haskell/sum-right-Scott/5000 4.297 ms 4.259 ms -0.9%
sum/compiled-from-Haskell/sum-right-data/100 228.6 μs 227.3 μs -0.6%
sum/compiled-from-Haskell/sum-right-data/500 1.253 ms 1.266 ms +1.0%
sum/compiled-from-Haskell/sum-right-data/1000 2.857 ms 2.872 ms +0.5%
sum/compiled-from-Haskell/sum-right-data/2500 7.718 ms 8.019 ms +3.9%
sum/compiled-from-Haskell/sum-right-data/5000 16.38 ms 16.54 ms +1.0%
sum/compiled-from-Haskell/sum-left-builtin/100 81.30 μs 79.13 μs -2.7%
sum/compiled-from-Haskell/sum-left-builtin/500 414.4 μs 406.9 μs -1.8%
sum/compiled-from-Haskell/sum-left-builtin/1000 898.2 μs 878.9 μs -2.1%
sum/compiled-from-Haskell/sum-left-builtin/2500 2.751 ms 2.713 ms -1.4%
sum/compiled-from-Haskell/sum-left-builtin/5000 6.070 ms 6.003 ms -1.1%
sum/compiled-from-Haskell/sum-left-Scott/100 44.77 μs 43.49 μs -2.9%
sum/compiled-from-Haskell/sum-left-Scott/500 240.5 μs 234.0 μs -2.7%
sum/compiled-from-Haskell/sum-left-Scott/1000 526.5 μs 515.0 μs -2.2%
sum/compiled-from-Haskell/sum-left-Scott/2500 1.808 ms 1.782 ms -1.4%
sum/compiled-from-Haskell/sum-left-Scott/5000 4.258 ms 4.177 ms -1.9%
sum/compiled-from-Haskell/sum-left-data/100 243.8 μs 239.4 μs -1.8%
sum/compiled-from-Haskell/sum-left-data/500 1.334 ms 1.355 ms +1.6%
sum/compiled-from-Haskell/sum-left-data/1000 3.042 ms 3.081 ms +1.3%
sum/compiled-from-Haskell/sum-left-data/2500 8.386 ms 8.317 ms -0.8%
sum/compiled-from-Haskell/sum-left-data/5000 17.40 ms 17.88 ms +2.8%
sum/hand-written-PLC/sum-right-builtin/100 55.35 μs 56.08 μs +1.3%
sum/hand-written-PLC/sum-right-builtin/500 283.1 μs 278.0 μs -1.8%
sum/hand-written-PLC/sum-right-builtin/1000 586.0 μs 583.3 μs -0.5%
sum/hand-written-PLC/sum-right-builtin/2500 1.716 ms 1.708 ms -0.5%
sum/hand-written-PLC/sum-right-builtin/5000 3.726 ms 3.712 ms -0.4%
sum/hand-written-PLC/sum-right-Scott/100 36.38 μs 35.98 μs -1.1%
sum/hand-written-PLC/sum-right-Scott/500 196.7 μs 198.9 μs +1.1%
sum/hand-written-PLC/sum-right-Scott/1000 423.2 μs 422.8 μs -0.1%
sum/hand-written-PLC/sum-right-Scott/2500 1.587 ms 1.590 ms +0.2%
sum/hand-written-PLC/sum-right-Scott/5000 4.498 ms 4.500 ms +0.0%
sum/hand-written-PLC/sum-left-builtin/100 58.77 μs 58.49 μs -0.5%
sum/hand-written-PLC/sum-left-builtin/500 292.2 μs 290.7 μs -0.5%
sum/hand-written-PLC/sum-left-builtin/1000 582.0 μs 579.6 μs -0.4%
sum/hand-written-PLC/sum-left-builtin/2500 1.448 ms 1.443 ms -0.3%
sum/hand-written-PLC/sum-left-builtin/5000 2.883 ms 2.870 ms -0.5%
sum/hand-written-PLC/sum-left-Scott/100 39.88 μs 40.31 μs +1.1%
sum/hand-written-PLC/sum-left-Scott/500 219.9 μs 219.0 μs -0.4%
sum/hand-written-PLC/sum-left-Scott/1000 496.3 μs 490.9 μs -1.1%
sum/hand-written-PLC/sum-left-Scott/2500 1.822 ms 1.819 ms -0.2%
sum/hand-written-PLC/sum-left-Scott/5000 4.627 ms 4.633 ms +0.1%
f0aca4d 6775175 Change
TOTAL 277.7 ms 275.6 ms -0.8%

Copy link
Contributor

@effectfully effectfully left a comment

Choose a reason for hiding this comment

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

Hate it.

Comment on lines +170 to +174
forgetAnn :: forall ann uni fun. NTerm uni fun ann -> NTerm uni fun Any
forgetAnn = unsafeCoerce

rememberAnn :: forall ann uni fun. NTerm uni fun Any -> NTerm uni fun ann
rememberAnn = unsafeCoerce
Copy link
Contributor

@effectfully effectfully Jul 8, 2025

Choose a reason for hiding this comment

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

Ugh, I'm really uncomfortable about that. Let's discuss it during the tech meeting.

@SeungheonOh
Copy link
Collaborator Author

I agree. Also, less reason to pursue this as there's a proper way for #7188. Closing

@SeungheonOh SeungheonOh closed this Jul 8, 2025
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