Skip to content

Commit

Permalink
accelerate core ruby requires (#1113)
Browse files Browse the repository at this point in the history
accelerate core ruby requires
  • Loading branch information
lamont-granquist authored Nov 13, 2019
2 parents 3f47c11 + 57a1f69 commit 8381e66
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/patches/ruby/ruby-fast-load_26.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/load.c b/load.c
index 576464fb68..ae89f63820 100644
--- a/load.c
+++ b/load.c
@@ -908,6 +908,11 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level, feature_func
if (loading) *path = rb_filesystem_str_new_cstr(loading);
return 'r';
}
+ else if ((ft = rb_feature_p(ftptr, 0, FALSE, FALSE, &loading)) == 's') {
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
+ return 's';
+ }
+
tmp = fname;
type = rb_find_file_ext_safe(&tmp, loadable_ext, safe_level);
switch (type) {
8 changes: 8 additions & 0 deletions config/software/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@
patch source: "ruby-no-stack-protector.patch", plevel: 1, env: patch_env
end

# accelerate requires of c-extension.
#
# this would break code which did `require "thing"` and loaded thing.so and
# then fiddled with the libpath and did `require "thing"` and loaded thing.rb
# over the top of it. AFAIK no sane ruby code should need to do that, and the
# cost of this behavior in core ruby is enormous.
patch source: "ruby-fast-load_26.patch", plevel: 1, env: patch_env

# disable libpath in mkmf across all platforms, it trolls omnibus and
# breaks the postgresql cookbook. i'm not sure why ruby authors decided
# this was a good idea, but it breaks our use case hard. AIX cannot even
Expand Down

0 comments on commit 8381e66

Please sign in to comment.