Feature #12973

[RFC] net/http: use require_relative to reduce syscalls

Added by normalperson (Eric Wong) 10 months ago. Updated 6 months ago.

Target version:


require_relative speeds up loading of files by reducing path
lookups. On a clean install with RubyGems-enabled,
"ruby -rnet/http -e exit" shows a reduction in failed open(2)
syscalls from 410 to 350 (x86-64 GNU/Linux).

I could not measure a time difference on my Linux-based
machines, however this should be noticeable to users of other
kernels with worse syscall and VFS performance than Linux.

Further use of require_relative will reduce lookups in other


Ideally, I'd like to get all of stdlib using require_relative.
Syscall failures annoy me greatly by making strace output noisy.

This is probably more suited for the 2.5 development cycle.

Related issues

Related to Ruby trunk - Feature #8781: Use require_relative() instead of require() if possibleOpen


#1 [ruby-core:78395] Updated by shevegen (Robert A. Heiler) 10 months ago

I have no particular pro or con opinion, not that it would be relevant anyway - but I am watching this closely out of interest what others have to say. :)

#2 [ruby-core:80197] Updated by hsbt (Hiroshi SHIBATA) 6 months ago

  • Target version set to 2.5
  • Assignee set to naruse (Yui NARUSE)
  • Status changed from Open to Assigned

#3 [ruby-core:80196] Updated by normalperson (Eric Wong) 6 months ago wrote:

Comments? Maybe I'll commit this, soon.

#5 Updated by shyouhei (Shyouhei Urabe) 6 months ago

  • Related to Feature #8781: Use require_relative() instead of require() if possible added

Also available in: Atom PDF