my ruby app starts up extremely slow after I upgrade from ruby version 2.3.1 to 2.7.2. My app does load quite some gems (using "require") at startup. Following code would take 29 secs on my windows 10 PC.
@jeremyevans0 (Jeremy Evans) (Jeremy Evans), thanks for your response. After some experiments, the issue can be boided down to the order of loading gems. If tk is loaded first, then the gems after them would take a long time to load. This becomes extreme with gem rubyXL. Here is the result:
my app use tk as gui. Before I use ruby 2.3.1 and I do not see this issue. After I upgrade to ruby 2.7.2, the issue shows up. And now I downgrade to ruby 2.6.6, the issue is still there.
From your own analysis, the problem seems to be in tk. I can replicate your issue:
$ time ruby -rsequel -rtk -e '1'
0m02.37s real 0m00.34s user 0m00.08s system
$ time ruby -rtk -rsequel -e '1'
0m09.37s real 0m00.19s user 0m00.08s system
However, tk is not in the standard library in any supported version of Ruby. You should file an issue in the ruby-tk bug tracker: https://github.com/ruby/tk/pulls
The simplest workaround would be to require tk after all other libraries.