Read more

How to fix: Pasting in IRB 1.2+ is very slow

Arne Hartherz
November 27, 2020Software engineer at makandra GmbH

IRB 1.2 (shipped with Ruby 2.7, but works on 2.5+) brings pretty syntax highlighting and multiline cursor navigation. However, pasting longer contents is incredibly slow. You can fix that by disabling said features. [1]

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Ruby 3.0.0-pre2 solved the issue Show archive.org snapshot (however, the fix does not appear to be included in IRB 1.2.6, it must be Ruby itself).

Option 1:

Add a command line flag when opening an IRB:

irb --nomultiline

This also works on modern Rails when using rails console like so:

rails console -- --nomultiline

Option 2: Disable by default

In your ~/.irbrc, add:

IRB.conf[:USE_MULTILINE] = false

Your IRB will be less pretty, but pasting will be fast again.


[1] Background:

It seems that multiline mode is the culprit, disabling colorization itself neither fixes nor improves the issue. However, disabling multiline mode implies disabling colorization.

Inspection output will still be colorized, unless you use --nocolorize or IRB.conf[:USE_COLORIZE] = false.

Posted by Arne Hartherz to makandra dev (2020-11-27 12:15)