Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactoring] Tweak 'PlutusTx.Data.AssocMap' #6509

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

effectfully
Copy link
Contributor

I was looking into what relies upon these instances

instance ToData BuiltinData where
    {-# INLINABLE toBuiltinData #-}
    toBuiltinData = id
instance FromData BuiltinData where
    {-# INLINABLE fromBuiltinData #-}
    fromBuiltinData d = Just d
instance UnsafeFromData BuiltinData where
    {-# INLINABLE unsafeFromBuiltinData #-}
    unsafeFromBuiltinData d = d

existing and a few things in PlutusTx.Data.AssocMap popped up, but none of them actually needs to rely on the instance, so I tweaked the code a bit.

@effectfully
Copy link
Contributor Author

/benchmark validation

@effectfully
Copy link
Contributor Author

/benchmark lists

1 similar comment
@effectfully
Copy link
Contributor Author

/benchmark lists

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'validation' on 'e94d73c65' (base) and 'd277e3991' (PR)

Results table
Script e94d73c d277e39 Change
auction_1-1 177.3 μs 178.5 μs +0.7%
auction_1-2 907.1 μs 628.4 μs -30.7%
auction_1-3 781.4 μs 625.7 μs -19.9%
auction_1-4 321.8 μs 330.1 μs +2.6%
auction_2-1 251.9 μs 259.6 μs +3.1%
auction_2-2 645.2 μs 910.4 μs +41.1%
auction_2-3 1.192 ms 885.0 μs -25.8%
auction_2-4 890.1 μs 624.6 μs -29.8%
auction_2-5 321.5 μs 335.3 μs +4.3%
crowdfunding-success-1 293.0 μs 302.7 μs +3.3%
crowdfunding-success-2 204.2 μs 303.4 μs +48.6%
crowdfunding-success-3 207.5 μs 303.5 μs +46.3%
currency-1 245.0 μs 352.7 μs +44.0%
escrow-redeem_1-1 344.8 μs 499.7 μs +44.9%
escrow-redeem_1-2 343.6 μs 499.7 μs +45.4%
escrow-redeem_2-1 403.0 μs 583.5 μs +44.8%
escrow-redeem_2-2 402.9 μs 582.5 μs +44.6%
escrow-redeem_2-3 455.6 μs 585.0 μs +28.4%
escrow-refund-1 216.8 μs 223.6 μs +3.1%
future-increase-margin-1 346.6 μs 353.5 μs +2.0%
future-increase-margin-2 756.3 μs 769.6 μs +1.8%
future-increase-margin-3 755.8 μs 770.8 μs +2.0%
future-increase-margin-4 682.3 μs 693.7 μs +1.7%
future-increase-margin-5 1.142 ms 1.155 ms +1.1%
future-pay-out-1 346.3 μs 353.4 μs +2.1%
future-pay-out-2 755.5 μs 769.8 μs +1.9%
future-pay-out-3 753.1 μs 768.1 μs +2.0%
future-pay-out-4 1.141 ms 1.154 ms +1.1%
future-settle-early-1 348.1 μs 353.9 μs +1.7%
future-settle-early-2 755.9 μs 770.4 μs +1.9%
future-settle-early-3 756.3 μs 771.7 μs +2.0%
future-settle-early-4 852.8 μs 862.1 μs +1.1%
game-sm-success_1-1 545.0 μs 556.8 μs +2.2%
game-sm-success_1-2 278.5 μs 286.9 μs +3.0%
game-sm-success_1-3 897.6 μs 911.1 μs +1.5%
game-sm-success_1-4 315.8 μs 326.4 μs +3.4%
game-sm-success_2-1 471.4 μs 555.5 μs +17.8%
game-sm-success_2-2 196.4 μs 288.3 μs +46.8%
game-sm-success_2-3 911.7 μs 908.3 μs -0.4%
game-sm-success_2-4 315.3 μs 325.8 μs +3.3%
game-sm-success_2-5 619.2 μs 910.5 μs +47.0%
game-sm-success_2-6 315.6 μs 325.9 μs +3.3%
multisig-sm-1 557.6 μs 566.1 μs +1.5%
multisig-sm-2 544.6 μs 552.6 μs +1.5%
multisig-sm-3 549.7 μs 560.3 μs +1.9%
multisig-sm-4 554.1 μs 563.6 μs +1.7%
multisig-sm-5 785.0 μs 798.2 μs +1.7%
multisig-sm-6 556.0 μs 565.7 μs +1.7%
multisig-sm-7 543.5 μs 553.7 μs +1.9%
multisig-sm-8 462.0 μs 558.4 μs +20.9%
multisig-sm-9 556.2 μs 564.3 μs +1.5%
multisig-sm-10 786.5 μs 798.2 μs +1.5%
ping-pong-1 456.0 μs 464.9 μs +2.0%
ping-pong-2 456.7 μs 394.8 μs -13.6%
ping-pong_2-1 277.9 μs 225.5 μs -18.9%
prism-1 234.9 μs 220.3 μs -6.2%
prism-2 573.2 μs 586.7 μs +2.4%
prism-3 513.2 μs 527.0 μs +2.7%
pubkey-1 198.0 μs 204.6 μs +3.3%
stablecoin_1-1 1.270 ms 1.295 ms +2.0%
stablecoin_1-2 272.4 μs 281.1 μs +3.2%
stablecoin_1-3 1.455 ms 1.490 ms +2.4%
stablecoin_1-4 287.1 μs 296.6 μs +3.3%
stablecoin_1-5 1.869 ms 1.921 ms +2.8%
stablecoin_1-6 345.1 μs 366.8 μs +6.3%
stablecoin_2-1 895.8 μs 1.297 ms +44.8%
stablecoin_2-2 192.2 μs 281.2 μs +46.3%
stablecoin_2-3 1.032 ms 1.488 ms +44.2%
stablecoin_2-4 202.1 μs 296.9 μs +46.9%
token-account-1 187.0 μs 244.9 μs +31.0%
token-account-2 331.7 μs 344.6 μs +3.9%
uniswap-1 405.8 μs 411.3 μs +1.4%
uniswap-2 217.7 μs 221.9 μs +1.9%
uniswap-3 1.736 ms 1.772 ms +2.1%
uniswap-4 328.0 μs 338.8 μs +3.3%
uniswap-5 1.143 ms 1.169 ms +2.3%
uniswap-6 315.9 μs 325.7 μs +3.1%
vesting-1 342.8 μs 349.2 μs +1.9%
e94d73c d277e39 Change
TOTAL 44.30 ms 46.85 ms +5.8%

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'lists' on 'e94d73c65' (base) and 'd277e3991' (PR)

Results table
Script e94d73c d277e39 Change
sort/ghcSort/50 332.2 μs 332.3 μs +0.0%
sort/ghcSort/100 533.5 μs 773.9 μs +45.1%
sort/ghcSort/150 950.3 μs 1.345 ms +41.5%
sort/ghcSort/200 1.276 ms 1.809 ms +41.8%
sort/ghcSort/250 1.653 ms 2.343 ms +41.7%
sort/ghcSort/300 2.260 ms 3.070 ms +35.8%
sort/insertionSort/50 1.130 ms 1.130 ms 0.0%
sort/insertionSort/100 4.522 ms 4.509 ms -0.3%
sort/insertionSort/150 10.12 ms 10.14 ms +0.2%
sort/insertionSort/200 18.10 ms 18.09 ms -0.1%
sort/insertionSort/250 28.44 ms 28.39 ms -0.2%
sort/insertionSort/300 41.04 ms 41.11 ms +0.2%
sort/mergeSort/50 968.5 μs 968.7 μs +0.0%
sort/mergeSort/100 2.222 ms 1.629 ms -26.7%
sort/mergeSort/150 3.586 ms 2.529 ms -29.5%
sort/mergeSort/200 5.028 ms 3.553 ms -29.3%
sort/mergeSort/250 6.609 ms 4.655 ms -29.6%
sort/mergeSort/300 8.039 ms 5.673 ms -29.4%
sort/quickSort/50 2.730 ms 1.925 ms -29.5%
sort/quickSort/100 11.04 ms 7.787 ms -29.5%
sort/quickSort/150 24.84 ms 17.50 ms -29.5%
sort/quickSort/200 44.05 ms 32.27 ms -26.7%
sort/quickSort/250 68.99 ms 50.37 ms -27.0%
sort/quickSort/300 99.44 ms 70.47 ms -29.1%
sum/compiled-from-Haskell/sum-right-builtin/100 131.4 μs 92.72 μs -29.4%
sum/compiled-from-Haskell/sum-right-builtin/500 690.2 μs 488.1 μs -29.3%
sum/compiled-from-Haskell/sum-right-builtin/1000 1.494 ms 1.055 ms -29.4%
sum/compiled-from-Haskell/sum-right-builtin/2500 4.578 ms 4.270 ms -6.7%
sum/compiled-from-Haskell/sum-right-builtin/5000 9.788 ms 6.905 ms -29.5%
sum/compiled-from-Haskell/sum-right-Scott/100 88.64 μs 62.42 μs -29.6%
sum/compiled-from-Haskell/sum-right-Scott/500 465.7 μs 328.4 μs -29.5%
sum/compiled-from-Haskell/sum-right-Scott/1000 999.0 μs 706.0 μs -29.3%
sum/compiled-from-Haskell/sum-right-Scott/2500 3.337 ms 2.366 ms -29.1%
sum/compiled-from-Haskell/sum-right-Scott/5000 7.565 ms 5.399 ms -28.6%
sum/compiled-from-Haskell/sum-right-data/100 352.9 μs 247.8 μs -29.8%
sum/compiled-from-Haskell/sum-right-data/500 1.923 ms 1.350 ms -29.8%
sum/compiled-from-Haskell/sum-right-data/1000 4.331 ms 3.048 ms -29.6%
sum/compiled-from-Haskell/sum-right-data/2500 11.71 ms 8.256 ms -29.5%
sum/compiled-from-Haskell/sum-right-data/5000 24.33 ms 17.20 ms -29.3%
sum/compiled-from-Haskell/sum-left-builtin/100 128.1 μs 90.45 μs -29.4%
sum/compiled-from-Haskell/sum-left-builtin/500 667.5 μs 473.7 μs -29.0%
sum/compiled-from-Haskell/sum-left-builtin/1000 1.430 ms 1.017 ms -28.9%
sum/compiled-from-Haskell/sum-left-builtin/2500 4.368 ms 3.125 ms -28.5%
sum/compiled-from-Haskell/sum-left-builtin/5000 9.659 ms 6.847 ms -29.1%
sum/compiled-from-Haskell/sum-left-Scott/100 85.19 μs 60.41 μs -29.1%
sum/compiled-from-Haskell/sum-left-Scott/500 446.6 μs 317.8 μs -28.8%
sum/compiled-from-Haskell/sum-left-Scott/1000 965.0 μs 685.5 μs -29.0%
sum/compiled-from-Haskell/sum-left-Scott/2500 3.123 ms 2.218 ms -29.0%
sum/compiled-from-Haskell/sum-left-Scott/5000 7.104 ms 5.072 ms -28.6%
sum/compiled-from-Haskell/sum-left-data/100 247.8 μs 252.1 μs +1.7%
sum/compiled-from-Haskell/sum-left-data/500 1.378 ms 1.381 ms +0.2%
sum/compiled-from-Haskell/sum-left-data/1000 3.098 ms 4.377 ms +41.3%
sum/compiled-from-Haskell/sum-left-data/2500 8.413 ms 11.90 ms +41.4%
sum/compiled-from-Haskell/sum-left-data/5000 26.42 ms 24.58 ms -7.0%
sum/hand-written-PLC/sum-right-builtin/100 125.5 μs 126.2 μs +0.6%
sum/hand-written-PLC/sum-right-builtin/500 636.7 μs 637.6 μs +0.1%
sum/hand-written-PLC/sum-right-builtin/1000 906.2 μs 1.319 ms +45.6%
sum/hand-written-PLC/sum-right-builtin/2500 2.607 ms 3.695 ms +41.7%
sum/hand-written-PLC/sum-right-builtin/5000 5.482 ms 7.775 ms +41.8%
sum/hand-written-PLC/sum-right-Scott/100 49.95 μs 71.09 μs +42.3%
sum/hand-written-PLC/sum-right-Scott/500 253.7 μs 360.4 μs +42.1%
sum/hand-written-PLC/sum-right-Scott/1000 531.9 μs 751.9 μs +41.4%
sum/hand-written-PLC/sum-right-Scott/2500 1.628 ms 2.304 ms +41.5%
sum/hand-written-PLC/sum-right-Scott/5000 3.818 ms 5.398 ms +41.4%
sum/hand-written-PLC/sum-left-builtin/100 92.90 μs 132.0 μs +42.1%
sum/hand-written-PLC/sum-left-builtin/500 459.8 μs 651.4 μs +41.7%
sum/hand-written-PLC/sum-left-builtin/1000 913.8 μs 1.300 ms +42.3%
sum/hand-written-PLC/sum-left-builtin/2500 2.267 ms 3.218 ms +41.9%
sum/hand-written-PLC/sum-left-builtin/5000 4.530 ms 6.460 ms +42.6%
sum/hand-written-PLC/sum-left-Scott/100 55.35 μs 53.83 μs -2.7%
sum/hand-written-PLC/sum-left-Scott/500 276.0 μs 274.7 μs -0.5%
sum/hand-written-PLC/sum-left-Scott/1000 559.8 μs 557.0 μs -0.5%
sum/hand-written-PLC/sum-left-Scott/2500 1.569 ms 2.230 ms +42.1%
sum/hand-written-PLC/sum-left-Scott/5000 3.430 ms 4.832 ms +40.9%
e94d73c d277e39 Change
TOTAL 557.4 ms 468.7 ms -15.9%

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'lists' on 'e94d73c65' (base) and 'd277e3991' (PR)

Results table
Script e94d73c d277e39 Change
sort/ghcSort/50 234.5 μs 234.9 μs +0.2%
sort/ghcSort/100 547.6 μs 550.1 μs +0.5%
sort/ghcSort/150 949.0 μs 955.3 μs +0.7%
sort/ghcSort/200 1.274 ms 1.282 ms +0.6%
sort/ghcSort/250 1.651 ms 1.659 ms +0.5%
sort/ghcSort/300 2.165 ms 2.176 ms +0.5%
sort/insertionSort/50 795.5 μs 801.7 μs +0.8%
sort/insertionSort/100 3.169 ms 4.379 ms +38.2%
sort/insertionSort/150 7.148 ms 10.21 ms +42.8%
sort/insertionSort/200 12.76 ms 18.15 ms +42.2%
sort/insertionSort/250 20.04 ms 28.46 ms +42.0%
sort/insertionSort/300 28.96 ms 41.39 ms +42.9%
sort/mergeSort/50 681.4 μs 967.8 μs +42.0%
sort/mergeSort/100 1.569 ms 2.228 ms +42.0%
sort/mergeSort/150 2.528 ms 3.596 ms +42.2%
sort/mergeSort/200 3.549 ms 5.040 ms +42.0%
sort/mergeSort/250 4.637 ms 6.570 ms +41.7%
sort/mergeSort/300 5.671 ms 5.674 ms +0.1%
sort/quickSort/50 1.929 ms 1.936 ms +0.4%
sort/quickSort/100 7.787 ms 7.809 ms +0.3%
sort/quickSort/150 17.59 ms 17.60 ms +0.1%
sort/quickSort/200 31.15 ms 31.14 ms -0.0%
sort/quickSort/250 74.10 ms 49.07 ms -33.8%
sort/quickSort/300 99.54 ms 70.92 ms -28.8%
sum/compiled-from-Haskell/sum-right-builtin/100 131.4 μs 92.84 μs -29.3%
sum/compiled-from-Haskell/sum-right-builtin/500 688.4 μs 487.4 μs -29.2%
sum/compiled-from-Haskell/sum-right-builtin/1000 1.494 ms 1.056 ms -29.3%
sum/compiled-from-Haskell/sum-right-builtin/2500 4.577 ms 3.240 ms -29.2%
sum/compiled-from-Haskell/sum-right-builtin/5000 9.780 ms 6.921 ms -29.2%
sum/compiled-from-Haskell/sum-right-Scott/100 88.95 μs 62.75 μs -29.5%
sum/compiled-from-Haskell/sum-right-Scott/500 465.4 μs 329.4 μs -29.2%
sum/compiled-from-Haskell/sum-right-Scott/1000 1.000 ms 706.7 μs -29.3%
sum/compiled-from-Haskell/sum-right-Scott/2500 3.333 ms 2.360 ms -29.2%
sum/compiled-from-Haskell/sum-right-Scott/5000 7.566 ms 5.377 ms -28.9%
sum/compiled-from-Haskell/sum-right-data/100 350.5 μs 247.7 μs -29.3%
sum/compiled-from-Haskell/sum-right-data/500 1.914 ms 1.351 ms -29.4%
sum/compiled-from-Haskell/sum-right-data/1000 4.310 ms 3.045 ms -29.4%
sum/compiled-from-Haskell/sum-right-data/2500 11.69 ms 8.252 ms -29.4%
sum/compiled-from-Haskell/sum-right-data/5000 24.22 ms 17.18 ms -29.1%
sum/compiled-from-Haskell/sum-left-builtin/100 128.4 μs 90.46 μs -29.5%
sum/compiled-from-Haskell/sum-left-builtin/500 668.6 μs 472.3 μs -29.4%
sum/compiled-from-Haskell/sum-left-builtin/1000 1.428 ms 1.013 ms -29.1%
sum/compiled-from-Haskell/sum-left-builtin/2500 4.409 ms 3.117 ms -29.3%
sum/compiled-from-Haskell/sum-left-builtin/5000 9.489 ms 6.833 ms -28.0%
sum/compiled-from-Haskell/sum-left-Scott/100 85.02 μs 60.16 μs -29.2%
sum/compiled-from-Haskell/sum-left-Scott/500 311.6 μs 317.4 μs +1.9%
sum/compiled-from-Haskell/sum-left-Scott/1000 978.7 μs 678.6 μs -30.7%
sum/compiled-from-Haskell/sum-left-Scott/2500 2.168 ms 3.192 ms +47.2%
sum/compiled-from-Haskell/sum-left-Scott/5000 5.017 ms 7.107 ms +41.7%
sum/compiled-from-Haskell/sum-left-data/100 251.2 μs 356.9 μs +42.1%
sum/compiled-from-Haskell/sum-left-data/500 1.373 ms 1.949 ms +42.0%
sum/compiled-from-Haskell/sum-left-data/1000 3.078 ms 4.375 ms +42.1%
sum/compiled-from-Haskell/sum-left-data/2500 8.366 ms 8.028 ms -4.0%
sum/compiled-from-Haskell/sum-left-data/5000 17.28 ms 17.39 ms +0.6%
sum/hand-written-PLC/sum-right-builtin/100 88.88 μs 88.63 μs -0.3%
sum/hand-written-PLC/sum-right-builtin/500 448.6 μs 448.9 μs +0.1%
sum/hand-written-PLC/sum-right-builtin/1000 1.113 ms 931.6 μs -16.3%
sum/hand-written-PLC/sum-right-builtin/2500 3.686 ms 2.609 ms -29.2%
sum/hand-written-PLC/sum-right-builtin/5000 7.754 ms 5.497 ms -29.1%
sum/hand-written-PLC/sum-right-Scott/100 70.73 μs 50.19 μs -29.0%
sum/hand-written-PLC/sum-right-Scott/500 351.6 μs 253.8 μs -27.8%
sum/hand-written-PLC/sum-right-Scott/1000 751.6 μs 534.0 μs -29.0%
sum/hand-written-PLC/sum-right-Scott/2500 2.290 ms 1.627 ms -29.0%
sum/hand-written-PLC/sum-right-Scott/5000 5.393 ms 3.819 ms -29.2%
sum/hand-written-PLC/sum-left-builtin/100 131.4 μs 92.82 μs -29.4%
sum/hand-written-PLC/sum-left-builtin/500 648.3 μs 459.7 μs -29.1%
sum/hand-written-PLC/sum-left-builtin/1000 1.291 ms 914.2 μs -29.2%
sum/hand-written-PLC/sum-left-builtin/2500 3.224 ms 2.269 ms -29.6%
sum/hand-written-PLC/sum-left-builtin/5000 6.422 ms 4.540 ms -29.3%
sum/hand-written-PLC/sum-left-Scott/100 78.10 μs 55.24 μs -29.3%
sum/hand-written-PLC/sum-left-Scott/500 387.9 μs 275.0 μs -29.1%
sum/hand-written-PLC/sum-left-Scott/1000 787.8 μs 557.0 μs -29.3%
sum/hand-written-PLC/sum-left-Scott/2500 2.195 ms 1.561 ms -28.9%
sum/hand-written-PLC/sum-left-Scott/5000 4.815 ms 3.419 ms -29.0%
e94d73c d277e39 Change
TOTAL 499.0 ms 448.5 ms -10.1%

Copy link
Contributor

@Unisay Unisay left a comment

Choose a reason for hiding this comment

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

LGTM

@effectfully effectfully merged commit 7436868 into master Sep 23, 2024
9 of 10 checks passed
@effectfully effectfully deleted the effectfully/refactoring/tweak-Data-AssocMap branch September 23, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Changelog Required Add this to skip the Changelog Check Plinth Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants