deivid-rodriguez / byebug

Debugging in Ruby 2
BSD 2-Clause "Simplified" License
3.34k stars 328 forks source link

Load IRB lazily #824

Open pocke opened 3 years ago

pocke commented 3 years ago

This PR makes loading IRB lazy. It improves startup time.

Problem

Byebug always loads IRB, but IRB is necessary only for irb command. It makes startup time slower unnecessarily for non-IRB users.

Solution

Let's load IRB lazily.

Benchmark

About 55ms (50%) faster.

before

$ RUBYLIB=lib ruby -rbenchmark -e 'p Benchmark.realtime{require "byebug/core"};'
0.11415267689153552

after

$ RUBYLIB=lib ruby -rbenchmark -e 'p Benchmark.realtime{require "byebug/core"};'
0.059115791926160455