Commit ad2a376
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 ad2a376
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
610 | 612 | | |
611 | 613 | | |
612 | 614 | | |
613 | 615 | | |
614 | 616 | | |
615 | | - | |
| 617 | + | |
616 | 618 | | |
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
620 | 622 | | |
621 | | - | |
622 | | - | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
623 | 627 | | |
624 | 628 | | |
625 | 629 | | |
| |||
0 commit comments