Skip to content

Commit 413d15a

Browse files
Edouard-chintenderlove
authored andcommitted
[ruby/rubygems] Add MAKEFLAGS=-j by default before compiling:
- Depending on the native extension, it can greatly reduce compilation time when executing recipes simultaneously. For example on Prism: ``` # Before time gem install prism Building native extensions. This could take a while... Successfully installed prism-1.6.0 1 gem installed gem install prism 3.61s user 0.80s system 95% cpu 4.595 total ``` ``` # After time MAKEFLAGS="-j" gem install prism Building native extensions. This could take a while... Successfully installed prism-1.6.0 1 gem installed MAKEFLAGS="-j" gem install prism 4.47s user 1.27s system 246% cpu 2.330 total ``` I don't think adding `-j` as a default is harmful, but I'm admitedly not very knowledgable when it comes to compiler. ruby/rubygems@61340081c6 Co-authored-by: Aaron Patterson <[email protected]>
1 parent 8c70def commit 413d15a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/rubygems/ext/ext_conf_builder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def self.build(extension, dest_path, results, args = [], lib_dir = nil, extensio
4040
end
4141

4242
ENV["DESTDIR"] = nil
43+
ENV["MAKEFLAGS"] ||= "-j#{Etc.nprocessors + 1}"
4344

4445
make dest_path, results, extension_dir, tmp_dest_relative, target_rbconfig: target_rbconfig
4546

0 commit comments

Comments
 (0)