Commit eb3a75d
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 3b62455 commit eb3a75d
1 file changed
Lines changed: 19 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
610 | 626 | | |
611 | 627 | | |
612 | 628 | | |
613 | 629 | | |
614 | 630 | | |
615 | | - | |
| 631 | + | |
616 | 632 | | |
617 | 633 | | |
618 | 634 | | |
619 | 635 | | |
620 | 636 | | |
621 | | - | |
| 637 | + | |
622 | 638 | | |
623 | 639 | | |
624 | 640 | | |
| |||
0 commit comments