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] Inline 'mkMachineParameters' in its full glory #4481

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

effectfully
Copy link
Contributor

A minimal version of #4435, no readKnown inlining, no nothing.

@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '8f6840162' (base) and 'a0d09aecc' (PR)

Script 8f68401 a0d09ae Change
auction_1-1 266.0 μs 242.6 μs -8.8%
auction_1-2 920.7 μs 885.3 μs -3.8%
auction_1-3 912.7 μs 876.4 μs -4.0%
auction_1-4 347.0 μs 313.3 μs -9.7%
auction_2-1 267.0 μs 242.2 μs -9.3%
auction_2-2 925.1 μs 884.3 μs -4.4%
auction_2-3 1.175 ms 1.118 ms -4.9%
auction_2-4 915.3 μs 871.9 μs -4.7%
auction_2-5 347.3 μs 313.8 μs -9.6%
crowdfunding-success-1 313.1 μs 284.8 μs -9.0%
crowdfunding-success-2 313.1 μs 284.0 μs -9.3%
crowdfunding-success-3 313.0 μs 284.5 μs -9.1%
currency-1 357.6 μs 334.9 μs -6.3%
escrow-redeem_1-1 520.8 μs 485.7 μs -6.7%
escrow-redeem_1-2 521.0 μs 488.2 μs -6.3%
escrow-redeem_2-1 610.8 μs 573.4 μs -6.1%
escrow-redeem_2-2 609.3 μs 571.3 μs -6.2%
escrow-redeem_2-3 611.4 μs 572.3 μs -6.4%
escrow-refund-1 233.6 μs 213.9 μs -8.4%
future-increase-margin-1 359.2 μs 335.5 μs -6.6%
future-increase-margin-2 792.3 μs 747.6 μs -5.6%
future-increase-margin-3 791.4 μs 749.6 μs -5.3%
future-increase-margin-4 735.9 μs 694.3 μs -5.7%
future-increase-margin-5 1.134 ms 1.077 ms -5.0%
future-pay-out-1 359.3 μs 336.0 μs -6.5%
future-pay-out-2 796.9 μs 749.1 μs -6.0%
future-pay-out-3 795.8 μs 748.3 μs -6.0%
future-pay-out-4 1.132 ms 1.072 ms -5.3%
future-settle-early-1 358.8 μs 336.7 μs -6.2%
future-settle-early-2 795.3 μs 751.0 μs -5.6%
future-settle-early-3 793.8 μs 753.7 μs -5.1%
future-settle-early-4 869.4 μs 833.5 μs -4.1%
game-sm-success_1-1 584.9 μs 551.0 μs -5.8%
game-sm-success_1-2 295.2 μs 267.9 μs -9.2%
game-sm-success_1-3 921.5 μs 880.4 μs -4.5%
game-sm-success_1-4 343.6 μs 313.0 μs -8.9%
game-sm-success_2-1 583.3 μs 550.7 μs -5.6%
game-sm-success_2-2 295.1 μs 268.1 μs -9.1%
game-sm-success_2-3 923.0 μs 878.4 μs -4.8%
game-sm-success_2-4 344.7 μs 311.7 μs -9.6%
game-sm-success_2-5 921.3 μs 876.8 μs -4.8%
game-sm-success_2-6 344.0 μs 311.5 μs -9.4%
multisig-sm-1 591.1 μs 559.1 μs -5.4%
multisig-sm-2 579.7 μs 547.3 μs -5.6%
multisig-sm-3 587.5 μs 554.0 μs -5.7%
multisig-sm-4 598.4 μs 559.4 μs -6.5%
multisig-sm-5 817.5 μs 778.1 μs -4.8%
multisig-sm-6 595.6 μs 561.2 μs -5.8%
multisig-sm-7 585.1 μs 546.3 μs -6.6%
multisig-sm-8 590.5 μs 553.3 μs -6.3%
multisig-sm-9 596.9 μs 558.8 μs -6.4%
multisig-sm-10 814.3 μs 776.0 μs -4.7%
ping-pong-1 492.1 μs 460.6 μs -6.4%
ping-pong-2 491.9 μs 461.4 μs -6.2%
ping-pong_2-1 298.5 μs 276.2 μs -7.5%
prism-1 246.7 μs 223.0 μs -9.6%
prism-2 634.6 μs 596.3 μs -6.0%
prism-3 539.3 μs 504.7 μs -6.4%
pubkey-1 209.9 μs 189.0 μs -10.0%
stablecoin_1-1 1.283 ms 1.219 ms -5.0%
stablecoin_1-2 286.4 μs 261.4 μs -8.7%
stablecoin_1-3 1.473 ms 1.389 ms -5.7%
stablecoin_1-4 307.1 μs 277.1 μs -9.8%
stablecoin_1-5 1.876 ms 1.750 ms -6.7%
stablecoin_1-6 383.2 μs 344.4 μs -10.1%
stablecoin_2-1 1.291 ms 1.213 ms -6.0%
stablecoin_2-2 286.5 μs 260.8 μs -9.0%
stablecoin_2-3 1.470 ms 1.393 ms -5.2%
stablecoin_2-4 306.0 μs 277.2 μs -9.4%
token-account-1 273.6 μs 254.5 μs -7.0%
token-account-2 482.5 μs 453.7 μs -6.0%
uniswap-1 582.3 μs 555.5 μs -4.6%
uniswap-2 324.2 μs 301.9 μs -6.9%
uniswap-3 2.382 ms 2.256 ms -5.3%
uniswap-4 508.3 μs 460.9 μs -9.3%
uniswap-5 1.666 ms 1.572 ms -5.6%
uniswap-6 485.6 μs 442.1 μs -9.0%
vesting-1 508.4 μs 480.6 μs -5.5%

@effectfully
Copy link
Contributor Author

effectfully commented Mar 21, 2022

-6.7% on average. The best we've seen so far in this series of PRs.

Somehow, unlifting (and lifting) now does get optimized without us inlining readKnown manually in TypeScheme and RuntimeScheme. I.e. the constructed KnownTypeIn dictionaries do get optimized in Core. I guess because this stuff now fully flows to the top level? Dunno, but there isn't much point in inlining readKnown manually now.

Costing stuff does not get optimized, since mkEvaluationContext takes a CostModelParams as an argument and so GHC can't look into that argument at compile time. However I think there's something that we can try here to make things a bit more efficient, gonna do that separately.

What's up with the CI?

Let's merge this bad boy.

@michaelpj
Copy link
Contributor

Baffling. Well, if the dumb approach works, that's nice I guess!

@michaelpj
Copy link
Contributor

The darwin builders are still broken, merging.

@michaelpj michaelpj merged commit dc92754 into master Mar 21, 2022
@effectfully effectfully deleted the effectfully/builtins/inline-mkMachineParameters branch March 21, 2022 10:26
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.

3 participants