Commit f791780
committed
mkmf: split
When `mkmf.rb` checks for functions via `have_func`, it compiles and
links a test program in a single clang invocation. On macOS, passing a
source file together with `-lruby.4.1-static` (28MB static archive) to
clang in one command triggers a ~1.4s overhead per invocation. Splitting
into two steps (compile `.c` to `.o`, then link `.o`) reduces this to
~0.14s — a 10x improvement per check.
This dramatically speeds up extension configuration:
- `ext/io/console`: 12.1s → 1.8s (6.7x faster)
- `ext/openssl`: 8.3s → 3.0s (2.8x faster)
- `ext/json`: 6.6s → 1.4s (4.7x faster)
- `ext/strscan`: 5.0s → 0.6s (8.3x faster)
Overall clean build: 52s → 44s (16% faster)try_link0 into separate compile and link steps1 parent 661344b commit f791780
1 file changed
Lines changed: 8 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | 558 | | |
564 | 559 | | |
565 | 560 | | |
| |||
606 | 601 | | |
607 | 602 | | |
608 | 603 | | |
609 | | - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
610 | 607 | | |
611 | 608 | | |
612 | 609 | | |
613 | 610 | | |
614 | 611 | | |
615 | | - | |
| 612 | + | |
616 | 613 | | |
617 | 614 | | |
618 | 615 | | |
619 | 616 | | |
620 | 617 | | |
621 | | - | |
622 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
623 | 622 | | |
624 | 623 | | |
625 | 624 | | |
| |||
3037 | 3036 | | |
3038 | 3037 | | |
3039 | 3038 | | |
3040 | | - | |
3041 | | - | |
3042 | | - | |
3043 | | - | |
3044 | | - | |
3045 | 3039 | | |
3046 | 3040 | | |
3047 | 3041 | | |
| |||
0 commit comments