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

[Builtins] Monomorphize 'makeKnown' #4421

Merged

Conversation

effectfully
Copy link
Contributor

Attempt №2.

Do not look here yet.

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and 'be641e9e6' (PR)

Script 0397f83 be641e9 Change
auction_1-1 279.0 μs 260.7 μs -6.6%
auction_1-2 937.2 μs 905.3 μs -3.4%
auction_1-3 932.0 μs 899.5 μs -3.5%
auction_1-4 363.8 μs 338.7 μs -6.9%
auction_2-1 280.6 μs 260.9 μs -7.0%
auction_2-2 937.4 μs 909.6 μs -3.0%
auction_2-3 1.185 ms 1.153 ms -2.7%
auction_2-4 935.8 μs 902.8 μs -3.5%
auction_2-5 365.3 μs 341.0 μs -6.7%
crowdfunding-success-1 331.6 μs 307.2 μs -7.4%
crowdfunding-success-2 331.4 μs 307.4 μs -7.2%
crowdfunding-success-3 331.4 μs 308.2 μs -7.0%
currency-1 367.8 μs 349.0 μs -5.1%
escrow-redeem_1-1 534.2 μs 509.1 μs -4.7%
escrow-redeem_1-2 534.7 μs 509.1 μs -4.8%
escrow-redeem_2-1 624.0 μs 595.4 μs -4.6%
escrow-redeem_2-2 624.1 μs 594.1 μs -4.8%
escrow-redeem_2-3 626.3 μs 594.3 μs -5.1%
escrow-refund-1 245.7 μs 228.5 μs -7.0%
future-increase-margin-1 367.4 μs 348.0 μs -5.3%
future-increase-margin-2 811.2 μs 780.5 μs -3.8%
future-increase-margin-3 815.1 μs 779.8 μs -4.3%
future-increase-margin-4 755.2 μs 721.3 μs -4.5%
future-increase-margin-5 1.153 ms 1.109 ms -3.8%
future-pay-out-1 367.6 μs 348.3 μs -5.3%
future-pay-out-2 813.8 μs 777.9 μs -4.4%
future-pay-out-3 811.5 μs 777.5 μs -4.2%
future-pay-out-4 1.145 ms 1.105 ms -3.5%
future-settle-early-1 367.2 μs 348.9 μs -5.0%
future-settle-early-2 811.4 μs 779.3 μs -4.0%
future-settle-early-3 811.6 μs 780.7 μs -3.8%
future-settle-early-4 887.3 μs 857.8 μs -3.3%
game-sm-success_1-1 600.2 μs 573.6 μs -4.4%
game-sm-success_1-2 312.2 μs 289.0 μs -7.4%
game-sm-success_1-3 942.4 μs 910.1 μs -3.4%
game-sm-success_1-4 363.8 μs 337.7 μs -7.2%
game-sm-success_2-1 599.7 μs 572.6 μs -4.5%
game-sm-success_2-2 310.8 μs 288.8 μs -7.1%
game-sm-success_2-3 938.6 μs 904.4 μs -3.6%
game-sm-success_2-4 362.7 μs 336.6 μs -7.2%
game-sm-success_2-5 937.7 μs 904.9 μs -3.5%
game-sm-success_2-6 362.9 μs 337.0 μs -7.1%
multisig-sm-1 606.8 μs 577.6 μs -4.8%
multisig-sm-2 596.6 μs 566.3 μs -5.1%
multisig-sm-3 600.8 μs 572.2 μs -4.8%
multisig-sm-4 608.1 μs 577.8 μs -5.0%
multisig-sm-5 835.1 μs 800.4 μs -4.2%
multisig-sm-6 606.2 μs 578.2 μs -4.6%
multisig-sm-7 595.1 μs 566.5 μs -4.8%
multisig-sm-8 602.2 μs 573.3 μs -4.8%
multisig-sm-9 609.0 μs 580.1 μs -4.7%
multisig-sm-10 840.0 μs 799.2 μs -4.9%
ping-pong-1 502.6 μs 477.7 μs -5.0%
ping-pong-2 502.5 μs 479.0 μs -4.7%
ping-pong_2-1 310.8 μs 291.2 μs -6.3%
prism-1 261.2 μs 240.0 μs -8.1%
prism-2 648.0 μs 619.1 μs -4.5%
prism-3 555.3 μs 528.1 μs -4.9%
pubkey-1 221.7 μs 203.3 μs -8.3%
stablecoin_1-1 1.312 ms 1.270 ms -3.2%
stablecoin_1-2 304.6 μs 281.9 μs -7.5%
stablecoin_1-3 1.490 ms 1.456 ms -2.3%
stablecoin_1-4 322.7 μs 299.0 μs -7.3%
stablecoin_1-5 1.899 ms 1.844 ms -2.9%
stablecoin_1-6 400.6 μs 371.4 μs -7.3%
stablecoin_2-1 1.309 ms 1.264 ms -3.4%
stablecoin_2-2 304.0 μs 280.9 μs -7.6%
stablecoin_2-3 1.496 ms 1.458 ms -2.5%
stablecoin_2-4 323.1 μs 299.1 μs -7.4%
token-account-1 284.7 μs 267.5 μs -6.0%
token-account-2 497.3 μs 471.7 μs -5.1%
uniswap-1 593.5 μs 569.6 μs -4.0%
uniswap-2 340.6 μs 319.7 μs -6.1%
uniswap-3 2.453 ms 2.370 ms -3.4%
uniswap-4 533.2 μs 495.8 μs -7.0%
uniswap-5 1.712 ms 1.645 ms -3.9%
uniswap-6 507.5 μs 472.3 μs -6.9%
vesting-1 522.9 μs 495.0 μs -5.3%

@effectfully
Copy link
Contributor Author

Wow, much better this time around.

Ready for review.

@@ -284,7 +285,7 @@ defaultSlippage :: Slippage
defaultSlippage = 200

-- | The CEK machine is parameterized over an emitter function, similar to 'CekBudgetSpender'.
type CekEmitter uni fun s = Text -> CekM uni fun s ()
type CekEmitter uni fun s = DList Text -> CekM uni fun s ()
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit sad that the monomorphization of readKnown means we have to commit to Writer (DList Text) and then that leaks up here too. But it would be annoying to traverse the list of logs to emit them in the machine's emitter. That said, that happens anyway in e.g. some of the log emitters for the CEK machine that assume they can post-process each log line individually. So maybe it's a false saving and it would be cleaner to just traverse the DList of logs and emit them again (given that most such lists should be small).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking about it, I feel like it was actually stupid to add DList here. A call to traverse_ has to be faster than a call to ?cekEmitter and in the vast majority of cases we're going to end up with no logs returned from the builtin application machinery. I'll remove that DList.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also in the CK machine for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here regardless of what you do?

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and '3156484b4' (PR)

Script 0397f83 3156484 Change
auction_1-1 278.9 μs 275.5 μs -1.2%
auction_1-2 935.5 μs 934.3 μs -0.1%
auction_1-3 929.9 μs 928.4 μs -0.2%
auction_1-4 363.9 μs 360.5 μs -0.9%
auction_2-1 280.7 μs 276.4 μs -1.5%
auction_2-2 935.7 μs 933.0 μs -0.3%
auction_2-3 1.187 ms 1.179 ms -0.7%
auction_2-4 930.0 μs 923.1 μs -0.7%
auction_2-5 364.6 μs 358.9 μs -1.6%
crowdfunding-success-1 332.4 μs 325.2 μs -2.2%
crowdfunding-success-2 331.8 μs 324.4 μs -2.2%
crowdfunding-success-3 332.6 μs 325.3 μs -2.2%
currency-1 368.1 μs 361.5 μs -1.8%
escrow-redeem_1-1 535.8 μs 530.1 μs -1.1%
escrow-redeem_1-2 535.8 μs 530.8 μs -0.9%
escrow-redeem_2-1 626.2 μs 619.4 μs -1.1%
escrow-redeem_2-2 623.8 μs 618.7 μs -0.8%
escrow-redeem_2-3 622.0 μs 619.1 μs -0.5%
escrow-refund-1 244.4 μs 242.6 μs -0.7%
future-increase-margin-1 367.5 μs 360.4 μs -1.9%
future-increase-margin-2 810.9 μs 809.1 μs -0.2%
future-increase-margin-3 809.8 μs 809.3 μs -0.1%
future-increase-margin-4 752.5 μs 747.0 μs -0.7%
future-increase-margin-5 1.151 ms 1.137 ms -1.2%
future-pay-out-1 368.3 μs 362.5 μs -1.6%
future-pay-out-2 815.6 μs 809.9 μs -0.7%
future-pay-out-3 813.9 μs 806.8 μs -0.9%
future-pay-out-4 1.145 ms 1.135 ms -0.9%
future-settle-early-1 368.0 μs 360.7 μs -2.0%
future-settle-early-2 809.8 μs 808.0 μs -0.2%
future-settle-early-3 814.4 μs 808.2 μs -0.8%
future-settle-early-4 886.8 μs 880.5 μs -0.7%
game-sm-success_1-1 598.8 μs 591.8 μs -1.2%
game-sm-success_1-2 310.9 μs 306.2 μs -1.5%
game-sm-success_1-3 941.0 μs 927.8 μs -1.4%
game-sm-success_1-4 364.6 μs 357.9 μs -1.8%
game-sm-success_2-1 601.6 μs 595.3 μs -1.0%
game-sm-success_2-2 312.4 μs 308.0 μs -1.4%
game-sm-success_2-3 940.0 μs 935.0 μs -0.5%
game-sm-success_2-4 363.0 μs 359.9 μs -0.9%
game-sm-success_2-5 938.5 μs 933.0 μs -0.6%
game-sm-success_2-6 362.3 μs 358.3 μs -1.1%
multisig-sm-1 605.2 μs 600.3 μs -0.8%
multisig-sm-2 594.0 μs 590.1 μs -0.7%
multisig-sm-3 601.3 μs 595.7 μs -0.9%
multisig-sm-4 609.4 μs 599.9 μs -1.6%
multisig-sm-5 835.9 μs 822.0 μs -1.7%
multisig-sm-6 606.4 μs 599.8 μs -1.1%
multisig-sm-7 595.1 μs 589.5 μs -0.9%
multisig-sm-8 599.9 μs 595.8 μs -0.7%
multisig-sm-9 608.0 μs 602.4 μs -0.9%
multisig-sm-10 833.6 μs 820.8 μs -1.5%
ping-pong-1 500.3 μs 495.6 μs -0.9%
ping-pong-2 499.4 μs 494.1 μs -1.1%
ping-pong_2-1 309.5 μs 305.8 μs -1.2%
prism-1 261.9 μs 256.7 μs -2.0%
prism-2 652.1 μs 640.8 μs -1.7%
prism-3 556.5 μs 549.2 μs -1.3%
pubkey-1 221.5 μs 216.6 μs -2.2%
stablecoin_1-1 1.312 ms 1.302 ms -0.8%
stablecoin_1-2 305.4 μs 298.9 μs -2.1%
stablecoin_1-3 1.499 ms 1.483 ms -1.1%
stablecoin_1-4 324.2 μs 317.2 μs -2.2%
stablecoin_1-5 1.900 ms 1.881 ms -1.0%
stablecoin_1-6 400.8 μs 394.6 μs -1.5%
stablecoin_2-1 1.306 ms 1.297 ms -0.7%
stablecoin_2-2 304.5 μs 299.9 μs -1.5%
stablecoin_2-3 1.495 ms 1.485 ms -0.7%
stablecoin_2-4 324.4 μs 317.1 μs -2.3%
token-account-1 284.3 μs 281.0 μs -1.2%
token-account-2 499.8 μs 493.7 μs -1.2%
uniswap-1 595.2 μs 587.1 μs -1.4%
uniswap-2 341.8 μs 335.7 μs -1.8%
uniswap-3 2.446 ms 2.397 ms -2.0%
uniswap-4 531.8 μs 525.7 μs -1.1%
uniswap-5 1.710 ms 1.681 ms -1.7%
uniswap-6 507.1 μs 502.4 μs -0.9%
vesting-1 521.3 μs 511.4 μs -1.9%

@michaelpj
Copy link
Contributor

Hmm, did that really make it slower?

@effectfully
Copy link
Contributor Author

Whoa, let's check.

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and '55a88822f' (PR)

Script 0397f83 55a8882 Change
auction_1-1 279.0 μs 260.8 μs -6.5%
auction_1-2 936.8 μs 910.5 μs -2.8%
auction_1-3 930.6 μs 902.9 μs -3.0%
auction_1-4 365.6 μs 340.8 μs -6.8%
auction_2-1 280.6 μs 261.3 μs -6.9%
auction_2-2 936.6 μs 909.4 μs -2.9%
auction_2-3 1.186 ms 1.153 ms -2.8%
auction_2-4 932.0 μs 901.2 μs -3.3%
auction_2-5 366.1 μs 341.3 μs -6.8%
crowdfunding-success-1 332.4 μs 307.8 μs -7.4%
crowdfunding-success-2 330.8 μs 307.9 μs -6.9%
crowdfunding-success-3 332.3 μs 308.3 μs -7.2%
currency-1 367.8 μs 350.8 μs -4.6%
escrow-redeem_1-1 536.1 μs 511.0 μs -4.7%
escrow-redeem_1-2 535.4 μs 510.8 μs -4.6%
escrow-redeem_2-1 625.7 μs 598.5 μs -4.3%
escrow-redeem_2-2 622.8 μs 596.9 μs -4.2%
escrow-redeem_2-3 626.2 μs 597.5 μs -4.6%
escrow-refund-1 245.9 μs 229.3 μs -6.8%
future-increase-margin-1 367.6 μs 348.6 μs -5.2%
future-increase-margin-2 812.3 μs 777.8 μs -4.2%
future-increase-margin-3 811.1 μs 779.1 μs -3.9%
future-increase-margin-4 755.5 μs 719.5 μs -4.8%
future-increase-margin-5 1.152 ms 1.114 ms -3.3%
future-pay-out-1 369.5 μs 349.4 μs -5.4%
future-pay-out-2 816.4 μs 780.7 μs -4.4%
future-pay-out-3 814.7 μs 780.2 μs -4.2%
future-pay-out-4 1.147 ms 1.107 ms -3.5%
future-settle-early-1 367.6 μs 349.1 μs -5.0%
future-settle-early-2 813.5 μs 779.6 μs -4.2%
future-settle-early-3 811.5 μs 780.9 μs -3.8%
future-settle-early-4 892.1 μs 854.6 μs -4.2%
game-sm-success_1-1 600.4 μs 574.6 μs -4.3%
game-sm-success_1-2 310.8 μs 290.3 μs -6.6%
game-sm-success_1-3 936.8 μs 912.2 μs -2.6%
game-sm-success_1-4 362.5 μs 338.3 μs -6.7%
game-sm-success_2-1 602.1 μs 575.0 μs -4.5%
game-sm-success_2-2 312.6 μs 289.6 μs -7.4%
game-sm-success_2-3 943.0 μs 910.7 μs -3.4%
game-sm-success_2-4 364.4 μs 337.4 μs -7.4%
game-sm-success_2-5 940.8 μs 906.3 μs -3.7%
game-sm-success_2-6 363.2 μs 336.8 μs -7.3%
multisig-sm-1 605.4 μs 580.7 μs -4.1%
multisig-sm-2 594.1 μs 568.0 μs -4.4%
multisig-sm-3 598.9 μs 573.0 μs -4.3%
multisig-sm-4 607.3 μs 579.7 μs -4.5%
multisig-sm-5 829.5 μs 801.2 μs -3.4%
multisig-sm-6 606.4 μs 581.1 μs -4.2%
multisig-sm-7 594.0 μs 569.1 μs -4.2%
multisig-sm-8 598.9 μs 575.3 μs -3.9%
multisig-sm-9 606.3 μs 580.8 μs -4.2%
multisig-sm-10 831.5 μs 799.5 μs -3.8%
ping-pong-1 499.0 μs 477.9 μs -4.2%
ping-pong-2 499.2 μs 479.5 μs -3.9%
ping-pong_2-1 309.1 μs 291.6 μs -5.7%
prism-1 261.3 μs 246.3 μs -5.7%
prism-2 650.3 μs 621.6 μs -4.4%
prism-3 555.9 μs 529.9 μs -4.7%
pubkey-1 221.4 μs 204.7 μs -7.5%
stablecoin_1-1 1.309 ms 1.271 ms -2.9%
stablecoin_1-2 305.8 μs 282.2 μs -7.7%
stablecoin_1-3 1.498 ms 1.460 ms -2.5%
stablecoin_1-4 324.3 μs 299.8 μs -7.6%
stablecoin_1-5 1.906 ms 1.858 ms -2.5%
stablecoin_1-6 401.5 μs 372.0 μs -7.3%
stablecoin_2-1 1.307 ms 1.270 ms -2.8%
stablecoin_2-2 304.8 μs 281.4 μs -7.7%
stablecoin_2-3 1.499 ms 1.461 ms -2.5%
stablecoin_2-4 324.0 μs 300.2 μs -7.3%
token-account-1 284.2 μs 268.6 μs -5.5%
token-account-2 497.1 μs 472.2 μs -5.0%
uniswap-1 594.2 μs 571.3 μs -3.9%
uniswap-2 341.5 μs 320.2 μs -6.2%
uniswap-3 2.444 ms 2.364 ms -3.3%
uniswap-4 532.3 μs 496.2 μs -6.8%
uniswap-5 1.711 ms 1.654 ms -3.3%
uniswap-6 507.9 μs 473.5 μs -6.8%
vesting-1 519.8 μs 497.8 μs -4.2%

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and 'c894010be' (PR)

Script 0397f83 c894010 Change
auction_1-1 279.4 μs 274.5 μs -1.8%
auction_1-2 940.5 μs 929.6 μs -1.2%
auction_1-3 934.7 μs 924.1 μs -1.1%
auction_1-4 364.8 μs 360.6 μs -1.2%
auction_2-1 280.3 μs 278.0 μs -0.8%
auction_2-2 940.8 μs 931.9 μs -0.9%
auction_2-3 1.186 ms 1.186 ms 0.0%
auction_2-4 933.9 μs 925.8 μs -0.9%
auction_2-5 363.8 μs 359.6 μs -1.2%
crowdfunding-success-1 330.7 μs 326.8 μs -1.2%
crowdfunding-success-2 331.7 μs 326.3 μs -1.6%
crowdfunding-success-3 332.4 μs 325.9 μs -2.0%
currency-1 367.1 μs 361.6 μs -1.5%
escrow-redeem_1-1 535.2 μs 529.1 μs -1.1%
escrow-redeem_1-2 535.3 μs 529.4 μs -1.1%
escrow-redeem_2-1 626.2 μs 619.2 μs -1.1%
escrow-redeem_2-2 628.9 μs 616.8 μs -1.9%
escrow-redeem_2-3 628.8 μs 618.8 μs -1.6%
escrow-refund-1 246.0 μs 242.3 μs -1.5%
future-increase-margin-1 368.7 μs 361.3 μs -2.0%
future-increase-margin-2 809.0 μs 806.5 μs -0.3%
future-increase-margin-3 812.3 μs 805.7 μs -0.8%
future-increase-margin-4 752.7 μs 743.1 μs -1.3%
future-increase-margin-5 1.150 ms 1.134 ms -1.4%
future-pay-out-1 367.3 μs 361.3 μs -1.6%
future-pay-out-2 813.1 μs 812.1 μs -0.1%
future-pay-out-3 812.2 μs 811.8 μs -0.0%
future-pay-out-4 1.145 ms 1.138 ms -0.6%
future-settle-early-1 369.2 μs 362.5 μs -1.8%
future-settle-early-2 816.9 μs 808.1 μs -1.1%
future-settle-early-3 815.7 μs 805.0 μs -1.3%
future-settle-early-4 887.3 μs 878.4 μs -1.0%
game-sm-success_1-1 599.8 μs 591.0 μs -1.5%
game-sm-success_1-2 310.8 μs 306.7 μs -1.3%
game-sm-success_1-3 934.5 μs 932.0 μs -0.3%
game-sm-success_1-4 362.2 μs 358.0 μs -1.2%
game-sm-success_2-1 599.0 μs 592.6 μs -1.1%
game-sm-success_2-2 311.5 μs 306.7 μs -1.5%
game-sm-success_2-3 937.7 μs 930.4 μs -0.8%
game-sm-success_2-4 363.0 μs 357.5 μs -1.5%
game-sm-success_2-5 937.3 μs 929.3 μs -0.9%
game-sm-success_2-6 363.2 μs 358.0 μs -1.4%
multisig-sm-1 607.3 μs 601.4 μs -1.0%
multisig-sm-2 596.3 μs 589.7 μs -1.1%
multisig-sm-3 603.0 μs 596.8 μs -1.0%
multisig-sm-4 611.2 μs 600.7 μs -1.7%
multisig-sm-5 834.8 μs 823.4 μs -1.4%
multisig-sm-6 608.8 μs 599.7 μs -1.5%
multisig-sm-7 596.7 μs 587.1 μs -1.6%
multisig-sm-8 601.0 μs 594.8 μs -1.0%
multisig-sm-9 608.8 μs 601.3 μs -1.2%
multisig-sm-10 831.9 μs 821.4 μs -1.3%
ping-pong-1 500.0 μs 494.6 μs -1.1%
ping-pong-2 498.2 μs 495.4 μs -0.6%
ping-pong_2-1 309.4 μs 303.5 μs -1.9%
prism-1 259.7 μs 254.7 μs -1.9%
prism-2 647.5 μs 639.7 μs -1.2%
prism-3 553.4 μs 549.4 μs -0.7%
pubkey-1 221.3 μs 216.2 μs -2.3%
stablecoin_1-1 1.307 ms 1.292 ms -1.1%
stablecoin_1-2 304.4 μs 299.5 μs -1.6%
stablecoin_1-3 1.496 ms 1.487 ms -0.6%
stablecoin_1-4 323.3 μs 318.8 μs -1.4%
stablecoin_1-5 1.901 ms 1.891 ms -0.5%
stablecoin_1-6 400.2 μs 394.6 μs -1.4%
stablecoin_2-1 1.311 ms 1.299 ms -0.9%
stablecoin_2-2 306.0 μs 299.4 μs -2.2%
stablecoin_2-3 1.500 ms 1.486 ms -0.9%
stablecoin_2-4 324.9 μs 317.5 μs -2.3%
token-account-1 285.0 μs 280.2 μs -1.7%
token-account-2 499.3 μs 491.3 μs -1.6%
uniswap-1 594.7 μs 583.2 μs -1.9%
uniswap-2 341.6 μs 335.1 μs -1.9%
uniswap-3 2.439 ms 2.390 ms -2.0%
uniswap-4 531.0 μs 525.5 μs -1.0%
uniswap-5 1.712 ms 1.679 ms -1.9%
uniswap-6 507.0 μs 500.9 μs -1.2%
vesting-1 519.9 μs 509.7 μs -2.0%

@effectfully
Copy link
Contributor Author

Hmm, did that really make it slower?

It seems it did. I consider myself challenged.

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

This reverts commit 9a19955.
@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and '668fa122e' (PR)

Script 0397f83 668fa12 Change
auction_1-1 278.3 μs 264.0 μs -5.1%
auction_1-2 933.3 μs 914.9 μs -2.0%
auction_1-3 932.6 μs 908.4 μs -2.6%
auction_1-4 363.5 μs 343.7 μs -5.4%
auction_2-1 279.8 μs 265.6 μs -5.1%
auction_2-2 935.6 μs 919.3 μs -1.7%
auction_2-3 1.181 ms 1.170 ms -0.9%
auction_2-4 929.7 μs 913.0 μs -1.8%
auction_2-5 364.0 μs 346.6 μs -4.8%
crowdfunding-success-1 332.0 μs 311.6 μs -6.1%
crowdfunding-success-2 331.1 μs 311.4 μs -5.9%
crowdfunding-success-3 331.4 μs 311.3 μs -6.1%
currency-1 367.5 μs 354.7 μs -3.5%
escrow-redeem_1-1 535.1 μs 514.5 μs -3.8%
escrow-redeem_1-2 534.9 μs 513.0 μs -4.1%
escrow-redeem_2-1 624.9 μs 601.1 μs -3.8%
escrow-redeem_2-2 623.6 μs 600.9 μs -3.6%
escrow-redeem_2-3 623.5 μs 602.5 μs -3.4%
escrow-refund-1 244.1 μs 232.8 μs -4.6%
future-increase-margin-1 367.7 μs 354.0 μs -3.7%
future-increase-margin-2 810.7 μs 782.1 μs -3.5%
future-increase-margin-3 810.6 μs 784.5 μs -3.2%
future-increase-margin-4 750.2 μs 728.4 μs -2.9%
future-increase-margin-5 1.152 ms 1.124 ms -2.4%
future-pay-out-1 368.0 μs 355.0 μs -3.5%
future-pay-out-2 813.0 μs 788.0 μs -3.1%
future-pay-out-3 811.6 μs 788.1 μs -2.9%
future-pay-out-4 1.146 ms 1.124 ms -1.9%
future-settle-early-1 366.5 μs 355.7 μs -2.9%
future-settle-early-2 806.4 μs 789.4 μs -2.1%
future-settle-early-3 812.9 μs 789.5 μs -2.9%
future-settle-early-4 887.0 μs 867.6 μs -2.2%
game-sm-success_1-1 598.8 μs 582.5 μs -2.7%
game-sm-success_1-2 310.2 μs 293.2 μs -5.5%
game-sm-success_1-3 937.1 μs 917.5 μs -2.1%
game-sm-success_1-4 363.8 μs 342.9 μs -5.7%
game-sm-success_2-1 601.2 μs 580.2 μs -3.5%
game-sm-success_2-2 311.6 μs 294.4 μs -5.5%
game-sm-success_2-3 938.6 μs 915.8 μs -2.4%
game-sm-success_2-4 363.2 μs 342.7 μs -5.6%
game-sm-success_2-5 940.2 μs 915.8 μs -2.6%
game-sm-success_2-6 362.8 μs 341.9 μs -5.8%
multisig-sm-1 604.5 μs 585.3 μs -3.2%
multisig-sm-2 591.9 μs 572.6 μs -3.3%
multisig-sm-3 600.3 μs 581.2 μs -3.2%
multisig-sm-4 607.8 μs 587.1 μs -3.4%
multisig-sm-5 833.3 μs 807.8 μs -3.1%
multisig-sm-6 606.7 μs 585.4 μs -3.5%
multisig-sm-7 593.3 μs 572.9 μs -3.4%
multisig-sm-8 598.3 μs 579.1 μs -3.2%
multisig-sm-9 606.2 μs 587.0 μs -3.2%
multisig-sm-10 836.1 μs 812.0 μs -2.9%
ping-pong-1 501.1 μs 486.6 μs -2.9%
ping-pong-2 501.3 μs 486.7 μs -2.9%
ping-pong_2-1 309.6 μs 296.0 μs -4.4%
prism-1 259.3 μs 245.0 μs -5.5%
prism-2 649.8 μs 628.1 μs -3.3%
prism-3 555.1 μs 534.1 μs -3.8%
pubkey-1 221.3 μs 208.2 μs -5.9%
stablecoin_1-1 1.306 ms 1.274 ms -2.5%
stablecoin_1-2 304.5 μs 286.3 μs -6.0%
stablecoin_1-3 1.492 ms 1.460 ms -2.1%
stablecoin_1-4 323.3 μs 303.9 μs -6.0%
stablecoin_1-5 1.900 ms 1.860 ms -2.1%
stablecoin_1-6 400.3 μs 377.1 μs -5.8%
stablecoin_2-1 1.302 ms 1.276 ms -2.0%
stablecoin_2-2 304.6 μs 286.2 μs -6.0%
stablecoin_2-3 1.494 ms 1.462 ms -2.1%
stablecoin_2-4 323.4 μs 305.1 μs -5.7%
token-account-1 284.2 μs 273.5 μs -3.8%
token-account-2 496.9 μs 477.5 μs -3.9%
uniswap-1 591.4 μs 583.0 μs -1.4%
uniswap-2 340.6 μs 326.4 μs -4.2%
uniswap-3 2.444 ms 2.390 ms -2.2%
uniswap-4 532.8 μs 504.9 μs -5.2%
uniswap-5 1.717 ms 1.664 ms -3.1%
uniswap-6 508.2 μs 482.6 μs -5.0%
vesting-1 520.3 μs 501.6 μs -3.6%

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and 'f7df4676f' (PR)

Script 0397f83 f7df467 Change
auction_1-1 278.3 μs 260.8 μs -6.3%
auction_1-2 936.2 μs 908.2 μs -3.0%
auction_1-3 930.3 μs 903.2 μs -2.9%
auction_1-4 365.5 μs 340.3 μs -6.9%
auction_2-1 281.7 μs 261.8 μs -7.1%
auction_2-2 940.6 μs 912.4 μs -3.0%
auction_2-3 1.192 ms 1.157 ms -2.9%
auction_2-4 934.9 μs 905.0 μs -3.2%
auction_2-5 364.3 μs 342.5 μs -6.0%
crowdfunding-success-1 330.8 μs 308.9 μs -6.6%
crowdfunding-success-2 330.4 μs 308.3 μs -6.7%
crowdfunding-success-3 330.9 μs 308.5 μs -6.8%
currency-1 367.7 μs 351.8 μs -4.3%
escrow-redeem_1-1 535.8 μs 511.4 μs -4.6%
escrow-redeem_1-2 536.5 μs 511.0 μs -4.8%
escrow-redeem_2-1 626.9 μs 597.7 μs -4.7%
escrow-redeem_2-2 624.7 μs 596.9 μs -4.5%
escrow-redeem_2-3 625.6 μs 597.1 μs -4.6%
escrow-refund-1 246.5 μs 229.9 μs -6.7%
future-increase-margin-1 367.5 μs 349.7 μs -4.8%
future-increase-margin-2 813.9 μs 781.0 μs -4.0%
future-increase-margin-3 813.6 μs 781.9 μs -3.9%
future-increase-margin-4 753.3 μs 722.8 μs -4.0%
future-increase-margin-5 1.150 ms 1.111 ms -3.4%
future-pay-out-1 367.3 μs 349.0 μs -5.0%
future-pay-out-2 810.7 μs 779.7 μs -3.8%
future-pay-out-3 813.9 μs 780.3 μs -4.1%
future-pay-out-4 1.147 ms 1.106 ms -3.6%
future-settle-early-1 366.8 μs 349.1 μs -4.8%
future-settle-early-2 814.4 μs 783.3 μs -3.8%
future-settle-early-3 817.5 μs 784.9 μs -4.0%
future-settle-early-4 889.2 μs 858.3 μs -3.5%
game-sm-success_1-1 600.5 μs 575.5 μs -4.2%
game-sm-success_1-2 311.6 μs 290.0 μs -6.9%
game-sm-success_1-3 938.6 μs 908.4 μs -3.2%
game-sm-success_1-4 363.2 μs 338.8 μs -6.7%
game-sm-success_2-1 598.8 μs 573.0 μs -4.3%
game-sm-success_2-2 310.7 μs 289.4 μs -6.9%
game-sm-success_2-3 939.2 μs 907.9 μs -3.3%
game-sm-success_2-4 362.8 μs 337.0 μs -7.1%
game-sm-success_2-5 939.5 μs 906.8 μs -3.5%
game-sm-success_2-6 363.2 μs 336.4 μs -7.4%
multisig-sm-1 606.5 μs 579.0 μs -4.5%
multisig-sm-2 594.7 μs 566.9 μs -4.7%
multisig-sm-3 603.4 μs 575.2 μs -4.7%
multisig-sm-4 612.2 μs 582.3 μs -4.9%
multisig-sm-5 840.2 μs 803.5 μs -4.4%
multisig-sm-6 611.4 μs 580.3 μs -5.1%
multisig-sm-7 597.8 μs 567.1 μs -5.1%
multisig-sm-8 602.6 μs 576.3 μs -4.4%
multisig-sm-9 609.6 μs 583.8 μs -4.2%
multisig-sm-10 834.3 μs 807.7 μs -3.2%
ping-pong-1 500.9 μs 483.1 μs -3.6%
ping-pong-2 498.9 μs 482.4 μs -3.3%
ping-pong_2-1 310.2 μs 293.6 μs -5.4%
prism-1 259.8 μs 242.2 μs -6.8%
prism-2 646.6 μs 621.9 μs -3.8%
prism-3 553.6 μs 529.0 μs -4.4%
pubkey-1 220.8 μs 203.7 μs -7.7%
stablecoin_1-1 1.305 ms 1.268 ms -2.8%
stablecoin_1-2 305.2 μs 282.3 μs -7.5%
stablecoin_1-3 1.500 ms 1.459 ms -2.7%
stablecoin_1-4 323.7 μs 298.8 μs -7.7%
stablecoin_1-5 1.901 ms 1.854 ms -2.5%
stablecoin_1-6 401.4 μs 373.0 μs -7.1%
stablecoin_2-1 1.305 ms 1.270 ms -2.7%
stablecoin_2-2 304.1 μs 282.1 μs -7.2%
stablecoin_2-3 1.499 ms 1.457 ms -2.8%
stablecoin_2-4 324.3 μs 299.6 μs -7.6%
token-account-1 285.1 μs 269.0 μs -5.6%
token-account-2 500.9 μs 474.3 μs -5.3%
uniswap-1 595.0 μs 575.1 μs -3.3%
uniswap-2 341.7 μs 320.7 μs -6.1%
uniswap-3 2.453 ms 2.367 ms -3.5%
uniswap-4 532.1 μs 495.2 μs -6.9%
uniswap-5 1.719 ms 1.640 ms -4.6%
uniswap-6 506.8 μs 472.1 μs -6.8%
vesting-1 520.8 μs 495.5 μs -4.9%

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and 'cda727926' (PR)

Script 0397f83 cda7279 Change
auction_1-1 279.4 μs 269.6 μs -3.5%
auction_1-2 937.5 μs 921.2 μs -1.7%
auction_1-3 933.2 μs 916.7 μs -1.8%
auction_1-4 365.2 μs 353.8 μs -3.1%
auction_2-1 279.8 μs 271.0 μs -3.1%
auction_2-2 940.0 μs 923.3 μs -1.8%
auction_2-3 1.198 ms 1.169 ms -2.4%
auction_2-4 937.1 μs 915.2 μs -2.3%
auction_2-5 366.2 μs 353.4 μs -3.5%
crowdfunding-success-1 331.5 μs 316.6 μs -4.5%
crowdfunding-success-2 332.0 μs 318.2 μs -4.2%
crowdfunding-success-3 330.7 μs 317.9 μs -3.9%
currency-1 367.3 μs 360.0 μs -2.0%
escrow-redeem_1-1 536.1 μs 523.4 μs -2.4%
escrow-redeem_1-2 537.1 μs 524.9 μs -2.3%
escrow-redeem_2-1 626.9 μs 614.3 μs -2.0%
escrow-redeem_2-2 626.2 μs 614.1 μs -1.9%
escrow-redeem_2-3 625.4 μs 614.0 μs -1.8%
escrow-refund-1 245.6 μs 237.6 μs -3.3%
future-increase-margin-1 368.4 μs 359.0 μs -2.6%
future-increase-margin-2 817.1 μs 784.9 μs -3.9%
future-increase-margin-3 814.2 μs 783.8 μs -3.7%
future-increase-margin-4 755.4 μs 733.3 μs -2.9%
future-increase-margin-5 1.153 ms 1.125 ms -2.4%
future-pay-out-1 368.6 μs 358.5 μs -2.7%
future-pay-out-2 813.4 μs 785.2 μs -3.5%
future-pay-out-3 812.8 μs 784.4 μs -3.5%
future-pay-out-4 1.149 ms 1.128 ms -1.8%
future-settle-early-1 367.9 μs 358.9 μs -2.4%
future-settle-early-2 813.3 μs 784.0 μs -3.6%
future-settle-early-3 812.7 μs 784.4 μs -3.5%
future-settle-early-4 894.0 μs 869.7 μs -2.7%
game-sm-success_1-1 601.4 μs 587.4 μs -2.3%
game-sm-success_1-2 313.1 μs 301.4 μs -3.7%
game-sm-success_1-3 943.9 μs 930.8 μs -1.4%
game-sm-success_1-4 365.0 μs 351.4 μs -3.7%
game-sm-success_2-1 600.9 μs 588.9 μs -2.0%
game-sm-success_2-2 310.2 μs 301.0 μs -3.0%
game-sm-success_2-3 937.9 μs 925.6 μs -1.3%
game-sm-success_2-4 362.7 μs 350.7 μs -3.3%
game-sm-success_2-5 940.8 μs 923.4 μs -1.8%
game-sm-success_2-6 363.9 μs 350.0 μs -3.8%
multisig-sm-1 607.1 μs 596.9 μs -1.7%
multisig-sm-2 595.4 μs 584.8 μs -1.8%
multisig-sm-3 599.6 μs 591.6 μs -1.3%
multisig-sm-4 608.4 μs 596.3 μs -2.0%
multisig-sm-5 837.4 μs 819.9 μs -2.1%
multisig-sm-6 607.9 μs 596.8 μs -1.8%
multisig-sm-7 596.7 μs 583.3 μs -2.2%
multisig-sm-8 603.2 μs 588.7 μs -2.4%
multisig-sm-9 611.2 μs 597.9 μs -2.2%
multisig-sm-10 837.5 μs 821.3 μs -1.9%
ping-pong-1 502.1 μs 491.9 μs -2.0%
ping-pong-2 501.6 μs 492.9 μs -1.7%
ping-pong_2-1 310.0 μs 300.3 μs -3.1%
prism-1 261.7 μs 251.8 μs -3.8%
prism-2 649.1 μs 637.5 μs -1.8%
prism-3 555.6 μs 545.5 μs -1.8%
pubkey-1 220.6 μs 212.2 μs -3.8%
stablecoin_1-1 1.304 ms 1.290 ms -1.1%
stablecoin_1-2 304.3 μs 293.6 μs -3.5%
stablecoin_1-3 1.493 ms 1.475 ms -1.2%
stablecoin_1-4 324.1 μs 310.9 μs -4.1%
stablecoin_1-5 1.903 ms 1.872 ms -1.6%
stablecoin_1-6 401.7 μs 388.4 μs -3.3%
stablecoin_2-1 1.309 ms 1.288 ms -1.6%
stablecoin_2-2 305.5 μs 293.9 μs -3.8%
stablecoin_2-3 1.499 ms 1.472 ms -1.8%
stablecoin_2-4 324.3 μs 311.4 μs -4.0%
token-account-1 283.6 μs 276.8 μs -2.4%
token-account-2 497.7 μs 487.6 μs -2.0%
uniswap-1 593.6 μs 585.7 μs -1.3%
uniswap-2 341.6 μs 331.4 μs -3.0%
uniswap-3 2.447 ms 2.413 ms -1.4%
uniswap-4 532.9 μs 515.9 μs -3.2%
uniswap-5 1.723 ms 1.679 ms -2.6%
uniswap-6 510.6 μs 491.9 μs -3.7%
vesting-1 524.2 μs 509.5 μs -2.8%

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

1 similar comment
@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and 'cda727926' (PR)

Script 0397f83 cda7279 Change
auction_1-1 280.1 μs 269.5 μs -3.8%
auction_1-2 936.7 μs 923.7 μs -1.4%
auction_1-3 933.4 μs 917.7 μs -1.7%
auction_1-4 365.0 μs 353.2 μs -3.2%
auction_2-1 280.1 μs 271.2 μs -3.2%
auction_2-2 940.9 μs 922.7 μs -1.9%
auction_2-3 1.196 ms 1.167 ms -2.4%
auction_2-4 935.0 μs 918.5 μs -1.8%
auction_2-5 365.1 μs 353.8 μs -3.1%
crowdfunding-success-1 331.3 μs 317.6 μs -4.1%
crowdfunding-success-2 331.6 μs 317.2 μs -4.3%
crowdfunding-success-3 330.6 μs 316.8 μs -4.2%
currency-1 366.8 μs 358.9 μs -2.2%
escrow-redeem_1-1 536.6 μs 524.6 μs -2.2%
escrow-redeem_1-2 535.6 μs 525.1 μs -2.0%
escrow-redeem_2-1 626.4 μs 614.3 μs -1.9%
escrow-redeem_2-2 625.2 μs 611.9 μs -2.1%
escrow-redeem_2-3 624.7 μs 613.2 μs -1.8%
escrow-refund-1 245.6 μs 237.7 μs -3.2%
future-increase-margin-1 369.1 μs 357.9 μs -3.0%
future-increase-margin-2 815.2 μs 783.9 μs -3.8%
future-increase-margin-3 813.0 μs 782.9 μs -3.7%
future-increase-margin-4 753.2 μs 734.9 μs -2.4%
future-increase-margin-5 1.144 ms 1.132 ms -1.0%
future-pay-out-1 366.9 μs 358.5 μs -2.3%
future-pay-out-2 809.4 μs 785.3 μs -3.0%
future-pay-out-3 812.4 μs 784.0 μs -3.5%
future-pay-out-4 1.147 ms 1.123 ms -2.1%
future-settle-early-1 368.3 μs 358.3 μs -2.7%
future-settle-early-2 811.1 μs 783.0 μs -3.5%
future-settle-early-3 816.3 μs 782.8 μs -4.1%
future-settle-early-4 893.6 μs 870.2 μs -2.6%
game-sm-success_1-1 602.5 μs 588.7 μs -2.3%
game-sm-success_1-2 312.4 μs 302.3 μs -3.2%
game-sm-success_1-3 940.6 μs 929.2 μs -1.2%
game-sm-success_1-4 363.1 μs 351.7 μs -3.1%
game-sm-success_2-1 598.1 μs 589.5 μs -1.4%
game-sm-success_2-2 311.0 μs 301.2 μs -3.2%
game-sm-success_2-3 937.0 μs 923.5 μs -1.4%
game-sm-success_2-4 364.1 μs 350.4 μs -3.8%
game-sm-success_2-5 938.2 μs 922.0 μs -1.7%
game-sm-success_2-6 363.7 μs 350.9 μs -3.5%
multisig-sm-1 606.4 μs 597.2 μs -1.5%
multisig-sm-2 595.7 μs 582.8 μs -2.2%
multisig-sm-3 603.5 μs 587.5 μs -2.7%
multisig-sm-4 610.7 μs 595.7 μs -2.5%
multisig-sm-5 839.5 μs 815.0 μs -2.9%
multisig-sm-6 609.5 μs 593.3 μs -2.7%
multisig-sm-7 597.3 μs 582.1 μs -2.5%
multisig-sm-8 602.5 μs 589.0 μs -2.2%
multisig-sm-9 609.6 μs 598.4 μs -1.8%
multisig-sm-10 834.7 μs 822.1 μs -1.5%
ping-pong-1 500.9 μs 491.5 μs -1.9%
ping-pong-2 502.0 μs 491.3 μs -2.1%
ping-pong_2-1 309.9 μs 299.0 μs -3.5%
prism-1 260.6 μs 250.2 μs -4.0%
prism-2 649.0 μs 636.2 μs -2.0%
prism-3 554.9 μs 543.1 μs -2.1%
pubkey-1 220.7 μs 212.0 μs -3.9%
stablecoin_1-1 1.310 ms 1.287 ms -1.8%
stablecoin_1-2 305.3 μs 293.6 μs -3.8%
stablecoin_1-3 1.499 ms 1.477 ms -1.5%
stablecoin_1-4 324.4 μs 312.8 μs -3.6%
stablecoin_1-5 1.901 ms 1.872 ms -1.5%
stablecoin_1-6 400.9 μs 387.8 μs -3.3%
stablecoin_2-1 1.303 ms 1.286 ms -1.3%
stablecoin_2-2 305.9 μs 292.4 μs -4.4%
stablecoin_2-3 1.505 ms 1.474 ms -2.1%
stablecoin_2-4 324.9 μs 312.3 μs -3.9%
token-account-1 283.9 μs 277.3 μs -2.3%
token-account-2 500.0 μs 486.3 μs -2.7%
uniswap-1 595.4 μs 585.2 μs -1.7%
uniswap-2 342.0 μs 331.2 μs -3.2%
uniswap-3 2.446 ms 2.405 ms -1.7%
uniswap-4 531.6 μs 515.9 μs -3.0%
uniswap-5 1.712 ms 1.666 ms -2.7%
uniswap-6 507.2 μs 491.2 μs -3.2%
vesting-1 520.0 μs 505.8 μs -2.7%

…to effectfully/builtins/performance/monomorphize-makeKnown
@effectfully
Copy link
Contributor Author

Here's a comparison of how -ddump-prep (sic) looks like for traverse_ ?cekEmitter vs ?cekEmitter:

RuntimeSchemeResult co1_ap8V $dKnownTypeIn1_sFnd ->   | RuntimeSchemeResult co1_ap8W $dKnownTypeIn1_sF8h ->
  let { sat_sFne = BBuiltinApp fun2_sFmy } in         |   let { sat_sF8i = BBuiltinApp fun2_sF7C } in
  case (((ds_sFdI `cast` <Co:4>)                      |   case (((ds_sEYM `cast` <Co:4>)
           sat_sFne (dt15_sFmO `cast` <Co:5>))        |            sat_sF8i (dt15_sF7S `cast` <Co:5>))
        `cast` <Co:9>)                                |         `cast` <Co:9>)
         w2_sFm6                                      |          w2_sF7a
  of                                                  |   of
  { (# ipv6_sFng, _ #) ->                             |   { (# ipv6_sF8k, _ #) ->
  let {                                               |   let {
    sat_sFnm                                          |     sat_sF8q
      = ((f4_sFmE `cast` <Co:9>) x_sFmN)              |       = ((f4_sF7I `cast` <Co:9>) x_sF7R)
        `cast` <Co:7> } in                            |         `cast` <Co:7> } in
  let {                                               |   let {
    sat_sFnk                                          |     sat_sF8o
      = case term1_sFmz of dt16_sFni { __DEFAULT ->   |       = case term1_sF7D of dt16_sF8m { __DEFAULT ->
        case argTerm_sFmG of dt17_sFnj { __DEFAULT -> |         case argTerm_sF7K of dt17_sF8n { __DEFAULT ->
        Apply () dt16_sFni dt17_sFnj                  |         Apply () dt16_sF8m dt17_sF8n
        }                                             |         }
        } } in                                        |         } } in
  let { sat_sFnl = Just sat_sFnk } in                 |   let { sat_sF8p = Just sat_sF8o } in
  case (makeKnown                                     |   case (makeKnown
          ($dKnownTypeIn1_sFnd `cast` <Co:8>)         |           ($dKnownTypeIn1_sF8h `cast` <Co:8>)
          sat_sFnl                                    |           sat_sF8p
          sat_sFnm)                                   |           sat_sF8q)
       `cast` <Co:44>                                 |        `cast` <Co:44>
  of                                                  |   of
  { (ipv8_sFno, ipv9_sFnp) ->                         |   { (ipv8_sF8s, ipv9_sF8t) ->
  case (ipv9_sFnp `cast` <Co:2>) [] of sat_sFnE       |   case ((ds16_sEYT ipv9_sF8t)
                                                      |            `cast` <Co:9>)      -- *
  { __DEFAULT ->                                      |          ipv6_sF8k
  join {                                              |   of
    $w$j_sFnq w3_sFnr                                 |   { (# ipv10_sF8v, _ #) ->
      = case ipv8_sFno of {                           |   case ipv8_sF8s of {
          Left err_sFnt ->                            |     Left err_sF8y ->
            jump exit7_sFhy w3_sFnr err_sFnt;         |       jump exit7_sF2C ipv10_sF8v err_sF8y;
          Right res1_sFnu ->                          |     Right res1_sF8z ->
            jump $wreturnCek_sFj2                     |       jump $wreturnCek_sF46
              ww_sFm3 ctx_sFm9 res1_sFnu w3_sFnr      |         ww_sF77 ctx_sF7d res1_sF8z ipv10_sF8v
        } } in                                        |   }
  joinrec {                                           |   }
    go1_sFnv ds22_sFnw eta_sFnx                       |   }
      = case ds22_sFnw of {                           |   }
          [] -> jump $w$j_sFnq eta_sFnx;              |
          : y_sFnz ys_sFnA ->                         |
            case ((ds16_sFdP y_sFnz)      -- *        |
                     `cast` <Co:9>)                   |
                   eta_sFnx                           |
            of                                        |
            { (# ipv10_sFnC, _ #) ->                  |
            jump go1_sFnv ys_sFnA ipv10_sFnC          |
            }                                         |
        }; } in                                       |
  jump go1_sFnv sat_sFnE ipv6_sFng                    |
  }                                                   |
  }                                                   |
  }                                                   |

Nothing unexpected. The former has a couple more join points and jumps, one additional matching and one (a few?) regular applications. Could we optimize some of that away? Yep, we could just use Church-encoded lists directly to avoid the matching and the recursion, see this commit. It does fill the performance gap for the most part, but using ?cekEmitter directly is still a bit faster (by ~1.3% on average). Why are we trying to avoid the latter? Surely it has to be the fastest, benchmarks and the main validation pipeline both run with ?cekEmitter set to noEmitter, which does emitting via \_ -> pure (), which is the fastest possible way of not doing any emitting.

I tried making CekEmitter

type CekEmitter uni fun s =
    DList Text -> CekM uni fun s (CekValue uni fun) -> CekM uni fun s (CekValue uni fun)

so that we can have \_ -> id in noEmitter to cut out one more indirection, but that was significantly slower, don't know why.

So... why am I even spending time here? Let's just make it ?cekEmitter logs (as opposed to traverse_ ?cekEmitter logs) and not bother. It's the fastest and it does make sense. Yes we now have DList in CekEmitter, but I don't think that matters at all.

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '0397f83b8' (base) and 'f3133745b' (PR)

Script 0397f83 f313374 Change
auction_1-1 278.7 μs 260.0 μs -6.7%
auction_1-2 934.2 μs 907.3 μs -2.9%
auction_1-3 931.1 μs 902.5 μs -3.1%
auction_1-4 364.7 μs 341.0 μs -6.5%
auction_2-1 279.7 μs 262.4 μs -6.2%
auction_2-2 938.6 μs 909.5 μs -3.1%
auction_2-3 1.187 ms 1.157 ms -2.5%
auction_2-4 931.7 μs 901.5 μs -3.2%
auction_2-5 363.9 μs 340.5 μs -6.4%
crowdfunding-success-1 330.7 μs 307.4 μs -7.0%
crowdfunding-success-2 332.2 μs 306.8 μs -7.6%
crowdfunding-success-3 331.1 μs 307.5 μs -7.1%
currency-1 368.4 μs 347.7 μs -5.6%
escrow-redeem_1-1 536.9 μs 510.2 μs -5.0%
escrow-redeem_1-2 535.1 μs 511.4 μs -4.4%
escrow-redeem_2-1 624.6 μs 599.6 μs -4.0%
escrow-redeem_2-2 623.5 μs 599.7 μs -3.8%
escrow-redeem_2-3 624.6 μs 598.0 μs -4.3%
escrow-refund-1 244.9 μs 230.2 μs -6.0%
future-increase-margin-1 367.7 μs 349.5 μs -4.9%
future-increase-margin-2 811.5 μs 780.1 μs -3.9%
future-increase-margin-3 810.6 μs 780.1 μs -3.8%
future-increase-margin-4 749.1 μs 722.5 μs -3.6%
future-increase-margin-5 1.149 ms 1.109 ms -3.5%
future-pay-out-1 368.1 μs 348.0 μs -5.5%
future-pay-out-2 811.4 μs 778.4 μs -4.1%
future-pay-out-3 813.4 μs 777.7 μs -4.4%
future-pay-out-4 1.150 ms 1.107 ms -3.7%
future-settle-early-1 367.1 μs 349.4 μs -4.8%
future-settle-early-2 808.9 μs 779.8 μs -3.6%
future-settle-early-3 812.9 μs 778.9 μs -4.2%
future-settle-early-4 890.6 μs 854.7 μs -4.0%
game-sm-success_1-1 598.5 μs 572.5 μs -4.3%
game-sm-success_1-2 311.2 μs 288.7 μs -7.2%
game-sm-success_1-3 936.1 μs 906.6 μs -3.2%
game-sm-success_1-4 363.3 μs 337.9 μs -7.0%
game-sm-success_2-1 600.8 μs 574.0 μs -4.5%
game-sm-success_2-2 311.3 μs 289.9 μs -6.9%
game-sm-success_2-3 939.9 μs 909.6 μs -3.2%
game-sm-success_2-4 362.5 μs 337.7 μs -6.8%
game-sm-success_2-5 937.7 μs 911.1 μs -2.8%
game-sm-success_2-6 362.7 μs 337.7 μs -6.9%
multisig-sm-1 606.3 μs 581.7 μs -4.1%
multisig-sm-2 595.4 μs 567.0 μs -4.8%
multisig-sm-3 599.6 μs 574.5 μs -4.2%
multisig-sm-4 606.2 μs 579.9 μs -4.3%
multisig-sm-5 832.3 μs 800.0 μs -3.9%
multisig-sm-6 605.9 μs 579.0 μs -4.4%
multisig-sm-7 594.4 μs 567.6 μs -4.5%
multisig-sm-8 599.6 μs 574.5 μs -4.2%
multisig-sm-9 607.0 μs 581.8 μs -4.2%
multisig-sm-10 832.4 μs 800.0 μs -3.9%
ping-pong-1 499.1 μs 479.4 μs -3.9%
ping-pong-2 499.1 μs 480.2 μs -3.8%
ping-pong_2-1 308.8 μs 291.1 μs -5.7%
prism-1 260.9 μs 240.9 μs -7.7%
prism-2 650.5 μs 616.9 μs -5.2%
prism-3 556.8 μs 526.5 μs -5.4%
pubkey-1 222.1 μs 202.7 μs -8.7%
stablecoin_1-1 1.306 ms 1.271 ms -2.7%
stablecoin_1-2 304.6 μs 282.3 μs -7.3%
stablecoin_1-3 1.497 ms 1.462 ms -2.3%
stablecoin_1-4 323.4 μs 300.5 μs -7.1%
stablecoin_1-5 1.903 ms 1.856 ms -2.5%
stablecoin_1-6 400.3 μs 372.4 μs -7.0%
stablecoin_2-1 1.303 ms 1.266 ms -2.8%
stablecoin_2-2 303.2 μs 281.5 μs -7.2%
stablecoin_2-3 1.498 ms 1.457 ms -2.7%
stablecoin_2-4 323.4 μs 298.9 μs -7.6%
token-account-1 284.3 μs 268.5 μs -5.6%
token-account-2 498.0 μs 471.9 μs -5.2%
uniswap-1 592.2 μs 570.6 μs -3.6%
uniswap-2 340.6 μs 319.1 μs -6.3%
uniswap-3 2.438 ms 2.358 ms -3.3%
uniswap-4 530.0 μs 496.5 μs -6.3%
uniswap-5 1.710 ms 1.649 ms -3.6%
uniswap-6 507.1 μs 473.3 μs -6.7%
vesting-1 522.6 μs 496.2 μs -5.1%

@michaelpj
Copy link
Contributor

So... why am I even spending time here? Let's just make it ?cekEmitter logs (as opposed to traverse_ ?cekEmitter logs) and not bother. It's the fastest and it does make sense. Yes we now have DList in CekEmitter, but I don't think that matters at all.

I agree, sounds fine.

@michaelpj
Copy link
Contributor

It was suspicious, you investigated, and it turns out to be fine. Good enough for me.

Copy link
Contributor

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

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

Has conflicts. Also could do with a comment about the DList, given how much effort you spent on working out that it's fine.

@effectfully
Copy link
Contributor Author

Also could do with a comment about the DList, given how much effort you spent on working out that it's fine.

Of course. I just wanted to get your approval first before documenting the solution.

@effectfully
Copy link
Contributor Author

Comments addressed, merging.

@effectfully effectfully merged commit edcf0e8 into master Mar 9, 2022
@effectfully effectfully deleted the effectfully/builtins/performance/monomorphize-makeKnown branch March 9, 2022 15:30
kwxm pushed a commit that referenced this pull request Mar 15, 2022
This monomorphizes `makeKnown` like `readKnown` was monomorphized previously.
This gives a speedup of 4.87% on average.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants