VSCode Terminal Paste Is Slow Because It Literally Sleeps Every 50 Characters
Description
A screenshot of a tweet by Jarred Sumner (@jarredsumner, creator of Bun runtime) on X.com. The tweet reads: 'Why is pasting into VSCode Terminal slow? Because it sleeps for 5ms every 50 characters.' Below the text is a code diff screenshot showing the actual VSCode source code. Lines 21-24 contain comments explaining: 'Writing large amounts of data can be corrupted for some reason, after looking into this is // appears to be a race condition around writing to the FD which may be based on how powerful the // hardware is. The workaround for this is to space out when large amounts of data is being written // to the terminal.' followed by constants 'WRITE_MAX_CHUNK_SIZE = 50' and 'WRITE_INTERVAL_MS = 5'. Lines 263-269 show the setTimeout implementation using these constants. A reference to github.com/microsoft/vscode/issues/38137 is included
Comments
25Comment deleted
The real race condition was between Microsoft fixing the bug properly and the heat death of the universe, and the universe is winning
There is nothing more stable than temporary Comment deleted
And here no one even said it was temporary Comment deleted
i've read the comments now Comment deleted
Link from meme: https://github.com/microsoft/vscode/issues/38137 Comment deleted
> closed as wontfix Comment deleted
and it wasn't even written by a ai, surely Comment deleted
It wasnt Comment deleted
MS is notorious on not getting how to display texts in terminal Comment deleted
can't be worse than jetbrains Comment deleted
much worse actually Comment deleted
this is shitiest coding possible. Vscode can not be trusted. 🤡🤡🤡🤡🤡🤡🤡 Comment deleted
Proving my point above because this is an unemployed comment and then he says he can’t make a PR for it, making him beyond unemployed Comment deleted
Old faithful "just put sleep in here and there would be no data race issues" Comment deleted
Double buffering and a mutex for swapping would fix this but js devs are not that smart Comment deleted
I dont know about internals of this, but still, how data race even possible if you just insert into stream. something go wrong on conceptual level here Comment deleted
Make a PR Comment deleted
965 pull requests are open on there oldest dated 2016. Do I really? Comment deleted
do 966 PRs Comment deleted
And? 46294 are closed. Are you just trying to find an excuse. Comment deleted
Anyways good idea but I shall continue excusing my lazyness Comment deleted
Must be a reason. Instead of optimizing something slow someone was lazy and just made a delay. I wonder what would break if this code is removed. Comment deleted
I love Internet Comment deleted
People thinking this is not acceptable and clowning it are beyond unemployed behavior Comment deleted
Solving race condition with delay, not because it is really needed but because it's just a lucky guess - that's as close to the clowning as it gets in programming. "Software shit " as Ivan puts it. Comment deleted