Commit df9fffb
committed
Merge #584: reduce binary bloat by removing generic param from type_check
0c411db reduce binary bloat by removing generic param from type_check (Marko Bencun)
Pull request description:
The binary sizes are increased a lot by the use of generics. In one case, there is a lot of needless bloat by using a generic type param for the callback argument in the type_check function of the Property trait.
cargo build --example parse --release && du -sb target/release/examples/parse
Results in a binary size of 1784152 bytes.
With this commit, the binary size is decreased by 12288 bytes, which is significant for embedded/no_std use.
The sizes above were achieved by adding this to Cargo.toml:
```
[profile.release]
strip = true
panic = "abort"
opt-level = 's'
codegen-units = 1
lto = true
```
Though the difference is roughly the same also without the optimizations.
As an additional benefit, code clarity is improved as the child arg was unused in some of the trait implementations.
ACKs for top commit:
apoelstra:
ACK 0c411db
sanket1729:
ACK 0c411db
Tree-SHA512: 5526076230a3d5140279567813f87764fc09f3fc8e95d031bf98f52726041afdb262af715a3af19ccae2c0c85069460c20bbe4073364b7a4a4e1378602835e29File tree
6 files changed
+78
-53
lines changed- src
- miniscript
- types
- policy
6 files changed
+78
-53
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 28 | | |
33 | 29 | | |
34 | 30 | | |
| |||
223 | 219 | | |
224 | 220 | | |
225 | 221 | | |
226 | | - | |
227 | | - | |
| 222 | + | |
| 223 | + | |
228 | 224 | | |
229 | 225 | | |
230 | 226 | | |
| |||
244 | 240 | | |
245 | 241 | | |
246 | 242 | | |
247 | | - | |
248 | | - | |
| 243 | + | |
| 244 | + | |
249 | 245 | | |
250 | 246 | | |
251 | 247 | | |
| |||
267 | 263 | | |
268 | 264 | | |
269 | 265 | | |
270 | | - | |
271 | | - | |
| 266 | + | |
| 267 | + | |
272 | 268 | | |
273 | 269 | | |
274 | 270 | | |
| |||
556 | 552 | | |
557 | 553 | | |
558 | 554 | | |
559 | | - | |
560 | | - | |
| 555 | + | |
| 556 | + | |
561 | 557 | | |
562 | 558 | | |
563 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
| 272 | + | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
891 | 903 | | |
892 | 904 | | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
| 905 | + | |
897 | 906 | | |
898 | | - | |
899 | 907 | | |
900 | 908 | | |
901 | 909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 23 | | |
30 | 24 | | |
31 | 25 | | |
| |||
374 | 368 | | |
375 | 369 | | |
376 | 370 | | |
377 | | - | |
378 | | - | |
379 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
380 | 374 | | |
381 | 375 | | |
382 | | - | |
| 376 | + | |
383 | 377 | | |
384 | 378 | | |
385 | 379 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | 380 | | |
392 | 381 | | |
393 | 382 | | |
| |||
523 | 512 | | |
524 | 513 | | |
525 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
526 | 539 | | |
527 | 540 | | |
528 | 541 | | |
| |||
767 | 780 | | |
768 | 781 | | |
769 | 782 | | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
770 | 795 | | |
771 | 796 | | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
| 797 | + | |
776 | 798 | | |
777 | | - | |
778 | 799 | | |
779 | 800 | | |
780 | 801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
495 | | - | |
| 494 | + | |
| 495 | + | |
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
501 | | - | |
502 | | - | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
517 | | - | |
518 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
524 | | - | |
525 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| |||
0 commit comments