These are chat archives for ManageIQ/manageiq/performance

5th
Dec 2018
Nick LaMuro
@NickLaMuro
Dec 05 2018 22:15

This was something that I noticed myself when working with webrick locally:

https://grosser.it/2016/12/05/webbrick-startup-is-slow-if-your-machine-name-looks-like-a-domain/

I was noticing it when I was hopping on "home" versus "coffeeshop" wifi, and even when just shutting off my wifi at home:
$ time ruby -r webrick -e ""

real    0m0.166s
user    0m0.124s
sys     0m0.038s

# turns off wifi...
$ time ruby -r webrick -e ""

real    0m5.498s
user    0m0.152s
sys     0m0.106s
anyway, thought it was kinda interesting, and something I would share. Fixed it with a minor monkey patch for personal use to I load early in the pipeline:
require 'webrick/utils'

module WEBrick::Utils
  def getservername
    Socket::gethostname.downcase
  end
  module_function :getservername
end