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

Effectfully/inline fix #6842

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For each boolean option, you can add a `no-` prefix to switch it off, such as `n

|Option|Value Type|Default|Description|
|-|-|-|-|
|`conservative-optimisation`|Bool|False|When conservative optimisation is used, only the optimisations that never make the program worse (in terms of cost or size) are employed. Implies `no-relaxed-float-in`, `no-inline-constants`, `no-simplifier-evaluate-builtins`, and `preserve-logging`.|
|`conservative-optimisation`|Bool|False|When conservative optimisation is used, only the optimisations that never make the program worse (in terms of cost or size) are employed. Implies `no-relaxed-float-in`, `no-inline-constants`, `no-inline-fix`, `no-simplifier-evaluate-builtins`, and `preserve-logging`.|
|`context-level`|Int|1|Set context level for error messages.|
|`coverage-all`|Bool|False|Add all available coverage annotations in the trace output|
|`coverage-boolean`|Bool|False|Add boolean coverage annotations in the trace output|
Expand All @@ -31,6 +31,7 @@ For each boolean option, you can add a `no-` prefix to switch it off, such as `n
|`dump-tplc`|Bool|False|Dump Typed Plutus Core|
|`dump-uplc`|Bool|False|Dump Untyped Plutus Core|
|`inline-constants`|Bool|True|Always inline constants. Inlining constants always reduces script costs slightly, but may increase script sizes if a large constant is used more than once. Implied by `no-conservative-optimisation`.|
|`inline-fix`|Bool|True|Always inline fixed point combinators. This is generally preferable as it often enables further optimization, though it may increase script size.|
|`max-cse-iterations`|Int|4|Set the max iterations for CSE|
|`max-simplifier-iterations-pir`|Int|12|Set the max iterations for the PIR simplifier|
|`max-simplifier-iterations-uplc`|Int|12|Set the max iterations for the UPLC simplifier|
Expand Down
4 changes: 2 additions & 2 deletions plutus-benchmark/bitwise/test/9.6/8 queens.budget.golden
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 409142294016
| mem: 1575213647})
({cpu: 409445366016
| mem: 1577107847})
2 changes: 1 addition & 1 deletion plutus-benchmark/bitwise/test/9.6/8 queens.size.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
397
395
Copy link
Contributor Author

@effectfully effectfully Feb 13, 2025

Choose a reason for hiding this comment

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

... but smaller size. And the best part is that the size even smaller than without inlining fix at all, i.e. this is smaller than on master.

Here's a three-way merge screenshot of CPU/MEM/size for "8 queens" (first @zliu41's branch, then master, then this branch):

Screenshot from 2025-02-13 02-01-41

4 changes: 2 additions & 2 deletions plutus-benchmark/bitwise/test/9.6/Ed25519.budget.golden
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 2137054479882
| mem: 7088444574})
({cpu: 2054166543882
| mem: 6570394974})
2 changes: 1 addition & 1 deletion plutus-benchmark/bitwise/test/9.6/Ed25519.size.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3417
3420
134 changes: 67 additions & 67 deletions plutus-benchmark/bls12-381-costs/test/9.6/bls12-381-costs.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,88 @@ Hash n bytestrings onto G1 and add points

n Script size CPU usage Memory usage
----------------------------------------------------------------------
0 115 (0.7%) 53556222 (0.5%) 3918 (0.0%)
10 224 (1.4%) 593877682 (5.9%) 37278 (0.3%)
20 334 (2.0%) 1134199142 (11.3%) 70638 (0.5%)
30 444 (2.7%) 1674520602 (16.7%) 103998 (0.7%)
40 554 (3.4%) 2214842062 (22.1%) 137358 (1.0%)
50 664 (4.1%) 2755163522 (27.6%) 170718 (1.2%)
60 774 (4.7%) 3295484982 (33.0%) 204078 (1.5%)
70 884 (5.4%) 3835806442 (38.4%) 237438 (1.7%)
80 994 (6.1%) 4376127902 (43.8%) 270798 (1.9%)
90 1104 (6.7%) 4916449362 (49.2%) 304158 (2.2%)
100 1214 (7.4%) 5456770822 (54.6%) 337518 (2.4%)
110 1324 (8.1%) 5997092282 (60.0%) 370878 (2.6%)
120 1434 (8.8%) 6537413742 (65.4%) 404238 (2.9%)
130 1544 (9.4%) 7077735202 (70.8%) 437598 (3.1%)
140 1654 (10.1%) 7618056662 (76.2%) 470958 (3.4%)
150 1764 (10.8%) 8158378122 (81.6%) 504318 (3.6%)
0 112 (0.7%) 53508222 (0.5%) 3618 (0.0%)
10 222 (1.4%) 593829682 (5.9%) 36978 (0.3%)
20 332 (2.0%) 1134151142 (11.3%) 70338 (0.5%)
30 442 (2.7%) 1674472602 (16.7%) 103698 (0.7%)
40 552 (3.4%) 2214794062 (22.1%) 137058 (1.0%)
50 662 (4.0%) 2755115522 (27.6%) 170418 (1.2%)
60 772 (4.7%) 3295436982 (33.0%) 203778 (1.5%)
70 882 (5.4%) 3835758442 (38.4%) 237138 (1.7%)
80 992 (6.1%) 4376079902 (43.8%) 270498 (1.9%)
90 1102 (6.7%) 4916401362 (49.2%) 303858 (2.2%)
100 1212 (7.4%) 5456722822 (54.6%) 337218 (2.4%)
110 1322 (8.1%) 5997044282 (60.0%) 370578 (2.6%)
120 1432 (8.7%) 6537365742 (65.4%) 403938 (2.9%)
130 1542 (9.4%) 7077687202 (70.8%) 437298 (3.1%)
140 1652 (10.1%) 7618008662 (76.2%) 470658 (3.4%)
150 1762 (10.8%) 8158330122 (81.6%) 504018 (3.6%)


Hash n bytestrings onto G2 and add points

n Script size CPU usage Memory usage
----------------------------------------------------------------------
0 163 (1.0%) 75306572 (0.8%) 3936 (0.0%)
10 272 (1.7%) 1769766432 (17.7%) 37656 (0.3%)
20 382 (2.3%) 3464226292 (34.6%) 71376 (0.5%)
30 492 (3.0%) 5158686152 (51.6%) 105096 (0.8%)
40 602 (3.7%) 6853146012 (68.5%) 138816 (1.0%)
50 712 (4.3%) 8547605872 (85.5%) 172536 (1.2%)
60 822 (5.0%) 10242065732 (102.4%) 206256 (1.5%)
70 932 (5.7%) 11936525592 (119.4%) 239976 (1.7%)
80 1042 (6.4%) 13630985452 (136.3%) 273696 (2.0%)
90 1152 (7.0%) 15325445312 (153.3%) 307416 (2.2%)
100 1262 (7.7%) 17019905172 (170.2%) 341136 (2.4%)
110 1372 (8.4%) 18714365032 (187.1%) 374856 (2.7%)
120 1482 (9.0%) 20408824892 (204.1%) 408576 (2.9%)
130 1592 (9.7%) 22103284752 (221.0%) 442296 (3.2%)
140 1702 (10.4%) 23797744612 (238.0%) 476016 (3.4%)
150 1812 (11.1%) 25492204472 (254.9%) 509736 (3.6%)
0 160 (1.0%) 75258572 (0.8%) 3636 (0.0%)
10 270 (1.6%) 1769718432 (17.7%) 37356 (0.3%)
20 380 (2.3%) 3464178292 (34.6%) 71076 (0.5%)
30 490 (3.0%) 5158638152 (51.6%) 104796 (0.7%)
40 600 (3.7%) 6853098012 (68.5%) 138516 (1.0%)
50 710 (4.3%) 8547557872 (85.5%) 172236 (1.2%)
60 820 (5.0%) 10242017732 (102.4%) 205956 (1.5%)
70 930 (5.7%) 11936477592 (119.4%) 239676 (1.7%)
80 1040 (6.3%) 13630937452 (136.3%) 273396 (2.0%)
90 1150 (7.0%) 15325397312 (153.3%) 307116 (2.2%)
100 1260 (7.7%) 17019857172 (170.2%) 340836 (2.4%)
110 1370 (8.4%) 18714317032 (187.1%) 374556 (2.7%)
120 1480 (9.0%) 20408776892 (204.1%) 408276 (2.9%)
130 1590 (9.7%) 22103236752 (221.0%) 441996 (3.2%)
140 1700 (10.4%) 23797696612 (238.0%) 475716 (3.4%)
150 1810 (11.0%) 25492156472 (254.9%) 509436 (3.6%)


Uncompress n G1 points and add the results

n Script size CPU usage Memory usage
----------------------------------------------------------------------
0 112 (0.7%) 53556222 (0.5%) 3918 (0.0%)
10 661 (4.0%) 597620792 (6.0%) 35278 (0.3%)
20 1211 (7.4%) 1141685362 (11.4%) 66638 (0.5%)
30 1761 (10.7%) 1685749932 (16.9%) 97998 (0.7%)
40 2311 (14.1%) 2229814502 (22.3%) 129358 (0.9%)
50 2861 (17.5%) 2773879072 (27.7%) 160718 (1.1%)
60 3411 (20.8%) 3317943642 (33.2%) 192078 (1.4%)
70 3961 (24.2%) 3862008212 (38.6%) 223438 (1.6%)
80 4511 (27.5%) 4406072782 (44.1%) 254798 (1.8%)
90 5061 (30.9%) 4950137352 (49.5%) 286158 (2.0%)
100 5611 (34.2%) 5494201922 (54.9%) 317518 (2.3%)
110 6161 (37.6%) 6038266492 (60.4%) 348878 (2.5%)
120 6711 (41.0%) 6582331062 (65.8%) 380238 (2.7%)
130 7261 (44.3%) 7126395632 (71.3%) 411598 (2.9%)
140 7811 (47.7%) 7670460202 (76.7%) 442958 (3.2%)
150 8361 (51.0%) 8214524772 (82.1%) 474318 (3.4%)
0 109 (0.7%) 53508222 (0.5%) 3618 (0.0%)
10 659 (4.0%) 597572792 (6.0%) 34978 (0.2%)
20 1209 (7.4%) 1141637362 (11.4%) 66338 (0.5%)
30 1759 (10.7%) 1685701932 (16.9%) 97698 (0.7%)
40 2309 (14.1%) 2229766502 (22.3%) 129058 (0.9%)
50 2859 (17.4%) 2773831072 (27.7%) 160418 (1.1%)
60 3409 (20.8%) 3317895642 (33.2%) 191778 (1.4%)
70 3959 (24.2%) 3861960212 (38.6%) 223138 (1.6%)
80 4509 (27.5%) 4406024782 (44.1%) 254498 (1.8%)
90 5059 (30.9%) 4950089352 (49.5%) 285858 (2.0%)
100 5609 (34.2%) 5494153922 (54.9%) 317218 (2.3%)
110 6159 (37.6%) 6038218492 (60.4%) 348578 (2.5%)
120 6709 (40.9%) 6582283062 (65.8%) 379938 (2.7%)
130 7259 (44.3%) 7126347632 (71.3%) 411298 (2.9%)
140 7809 (47.7%) 7670412202 (76.7%) 442658 (3.2%)
150 8359 (51.0%) 8214476772 (82.1%) 474018 (3.4%)


Uncompress n G2 points and add the results

n Script size CPU usage Memory usage
----------------------------------------------------------------------
0 160 (1.0%) 75306572 (0.8%) 3936 (0.0%)
10 1189 (7.3%) 847209652 (8.5%) 35656 (0.3%)
20 2219 (13.5%) 1619112732 (16.2%) 67376 (0.5%)
30 3249 (19.8%) 2391015812 (23.9%) 99096 (0.7%)
40 4279 (26.1%) 3162918892 (31.6%) 130816 (0.9%)
50 5309 (32.4%) 3934821972 (39.3%) 162536 (1.2%)
60 6339 (38.7%) 4706725052 (47.1%) 194256 (1.4%)
70 7369 (45.0%) 5478628132 (54.8%) 225976 (1.6%)
80 8399 (51.3%) 6250531212 (62.5%) 257696 (1.8%)
90 9429 (57.6%) 7022434292 (70.2%) 289416 (2.1%)
100 10459 (63.8%) 7794337372 (77.9%) 321136 (2.3%)
110 11489 (70.1%) 8566240452 (85.7%) 352856 (2.5%)
120 12519 (76.4%) 9338143532 (93.4%) 384576 (2.7%)
130 13549 (82.7%) 10110046612 (101.1%) 416296 (3.0%)
140 14579 (89.0%) 10881949692 (108.8%) 448016 (3.2%)
150 15609 (95.3%) 11653852772 (116.5%) 479736 (3.4%)
0 157 (1.0%) 75258572 (0.8%) 3636 (0.0%)
10 1187 (7.2%) 847161652 (8.5%) 35356 (0.3%)
20 2217 (13.5%) 1619064732 (16.2%) 67076 (0.5%)
30 3247 (19.8%) 2390967812 (23.9%) 98796 (0.7%)
40 4277 (26.1%) 3162870892 (31.6%) 130516 (0.9%)
50 5307 (32.4%) 3934773972 (39.3%) 162236 (1.2%)
60 6337 (38.7%) 4706677052 (47.1%) 193956 (1.4%)
70 7367 (45.0%) 5478580132 (54.8%) 225676 (1.6%)
80 8397 (51.3%) 6250483212 (62.5%) 257396 (1.8%)
90 9427 (57.5%) 7022386292 (70.2%) 289116 (2.1%)
100 10457 (63.8%) 7794289372 (77.9%) 320836 (2.3%)
110 11487 (70.1%) 8566192452 (85.7%) 352556 (2.5%)
120 12517 (76.4%) 9338095532 (93.4%) 384276 (2.7%)
130 13547 (82.7%) 10109998612 (101.1%) 415996 (3.0%)
140 14577 (89.0%) 10881901692 (108.8%) 447716 (3.2%)
150 15607 (95.3%) 11653804772 (116.5%) 479436 (3.4%)


Apply pairing to two pairs of points in G1 x G2 and run finalVerify on the results
Expand All @@ -103,7 +103,7 @@ VRF example

n Script size CPU usage Memory usage
----------------------------------------------------------------------
- 714 (4.4%) 1220805236 (12.2%) 48149 (0.3%)
- 707 (4.3%) 1219365236 (12.2%) 39149 (0.3%)

G1 Verify

Expand All @@ -121,13 +121,13 @@ Aggregate Single Key

n Script size CPU usage Memory usage
----------------------------------------------------------------------
- 846 (5.2%) 2720886359 (27.2%) 70002 (0.5%)
- 836 (5.1%) 2718726359 (27.2%) 56502 (0.4%)

Aggregate Multi Key

n Script size CPU usage Memory usage
----------------------------------------------------------------------
- 1832 (11.2%) 3446371236 (34.5%) 422386 (3.0%)
- 1847 (11.3%) 3433651236 (34.3%) 342886 (2.4%)

Schnorr Signature G1

Expand Down
32 changes: 16 additions & 16 deletions plutus-benchmark/ed25519-costs/test/9.6/ed25519-costs.golden
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
n Script size CPU usage Memory usage
----------------------------------------------------------------------
0 458 (2.8%) 5130441 (0.1%) 25722 (0.2%)
10 2185 (13.3%) 646555741 (6.5%) 514552 (3.7%)
20 3912 (23.9%) 1287981041 (12.9%) 1003382 (7.2%)
30 5639 (34.4%) 1929406341 (19.3%) 1492212 (10.7%)
40 7366 (45.0%) 2570831641 (25.7%) 1981042 (14.2%)
50 9092 (55.5%) 3212256941 (32.1%) 2469872 (17.6%)
60 10819 (66.0%) 3853682241 (38.5%) 2958702 (21.1%)
70 12546 (76.6%) 4495107541 (45.0%) 3447532 (24.6%)
80 14272 (87.1%) 5136532841 (51.4%) 3936362 (28.1%)
90 15999 (97.7%) 5777958141 (57.8%) 4425192 (31.6%)
100 17726 (108.2%) 6419383441 (64.2%) 4914022 (35.1%)
110 19453 (118.7%) 7060808741 (70.6%) 5402852 (38.6%)
120 21179 (129.3%) 7702234041 (77.0%) 5891682 (42.1%)
130 22906 (139.8%) 8343659341 (83.4%) 6380512 (45.6%)
140 24633 (150.3%) 8985084641 (89.9%) 6869342 (49.1%)
150 26360 (160.9%) 9626509941 (96.3%) 7358172 (52.6%)
0 455 (2.8%) 4890441 (0.0%) 24222 (0.2%)
10 2182 (13.3%) 645355741 (6.5%) 507052 (3.6%)
20 3909 (23.9%) 1285821041 (12.9%) 989882 (7.1%)
30 5636 (34.4%) 1926286341 (19.3%) 1472712 (10.5%)
40 7363 (44.9%) 2566751641 (25.7%) 1955542 (14.0%)
50 9089 (55.5%) 3207216941 (32.1%) 2438372 (17.4%)
60 10816 (66.0%) 3847682241 (38.5%) 2921202 (20.9%)
70 12543 (76.6%) 4488147541 (44.9%) 3404032 (24.3%)
80 14269 (87.1%) 5128612841 (51.3%) 3886862 (27.8%)
90 15996 (97.6%) 5769078141 (57.7%) 4369692 (31.2%)
100 17723 (108.2%) 6409543441 (64.1%) 4852522 (34.7%)
110 19450 (118.7%) 7050008741 (70.5%) 5335352 (38.1%)
120 21176 (129.2%) 7690474041 (76.9%) 5818182 (41.6%)
130 22903 (139.8%) 8330939341 (83.3%) 6301012 (45.0%)
140 24630 (150.3%) 8971404641 (89.7%) 6783842 (48.5%)
150 26357 (160.9%) 9611869941 (96.1%) 7266672 (51.9%)

Off-chain version succeeded on 100 inputs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 197510904
| mem: 846852})
({cpu: 188294904
| mem: 789252})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 16499812194
| mem: 70488132})
({cpu: 15544516194
| mem: 64517532})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 59141074
| mem: 255392})
({cpu: 56885074
| mem: 241292})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 4212184144
| mem: 17998532})
({cpu: 3974488144
| mem: 16512932})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 117905780
| mem: 564480})
({cpu: 112001780
| mem: 527580})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 8992550900
| mem: 41599800})
({cpu: 8502806900
| mem: 38538900})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 37925190
| mem: 186640})
({cpu: 36101190
| mem: 175240})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 2323012500
| mem: 10794400})
({cpu: 2198068500
| mem: 10013500})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 203554074
| mem: 988490})
({cpu: 191538074
| mem: 913390})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 296248136
| mem: 1507304})
({cpu: 275736136
| mem: 1379104})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 218828188
| mem: 1072854})
({cpu: 204732188
| mem: 984754})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 177375938
| mem: 850422})
({cpu: 166527938
| mem: 782622})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 199201946
| mem: 960932})
({cpu: 186881946
| mem: 883932})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 185596754
| mem: 887072})
({cpu: 175164754
| mem: 821872})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 184435055
| mem: 880470})
({cpu: 174099055
| mem: 815870})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 231014344
| mem: 1131576})
({cpu: 216022344
| mem: 1037876})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 214343877
| mem: 1046444})
({cpu: 200855877
| mem: 962144})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 198142226
| mem: 955410})
({cpu: 186062226
| mem: 879910})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 219510582
| mem: 1070794})
({cpu: 206214582
| mem: 987694})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 220655269
| mem: 1084970})
({cpu: 206303269
| mem: 995270})
Loading