Pasting long json in REPL is slow

Version

v14.18.1

Platform

Linux thinkpad-e570 5.14.13-200.fc34.x86_64 #1 SMP Mon Oct 18 12:39:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  1. Copy a large amount of data to your clipboard¹
  2. Open the nodejs REPL
  3. Paste the data

¹ The effect can be observed starting at ~2000 chars on my pc with an Intel i7-7500U (4) @ 3.500GHz).
I generated the data using cat /dev/zero | head -c 2000 | tr "\0" 0 | wl-copy

How often does it reproduce? Is there a required condition?

It is consistent and becomes more noticeable with a larger clipboard content

What is the expected behavior?

The pasting should happen instantaneous

python-repl.mp4

What do you see instead?

One can see how the content trickles in bit by bit

nodejs-repl.mp4

Additional information

I am using Gnome Terminal but can observe the same behaviour in other terminals like Alacritty. The cpu utilization when pasting goes up to 100%. Other REPLs like python do not show the same behaviour.