I'm actually quite surprised that it takes over 30 seconds to go through only 300000 items and generate some text with them. Unless the story is from ancient times, that is.
30 seconds seems awefully long indeed and it's probably not on a modern / 2022 computer, but RichText clipboard data in windows does a lot of processing to render in a way that fit context, eg copy a few excel row, paste them in whatsapp webapp and you have a picture, not text.
As a tech user, you quickly learn to fall in love with "paste as raw text", which skips all that and just give you text data.
You would think that, but try injecting 5K rows table into html document. My experience in Chrome and modern 4GHz CPU:
'6K rows, 300ms to insert into page on paper (console.time(1); console.timeEnd(1)), but in reality browser freezes for 3 seconds (1.8s style, 900ms layout, 300ms update tree). Freezing goes away with position: absolute, but it still takes 3 seconds to show up after .appendChild. I tried replacing Table with Flex divs, even worse speed.'
I imagine I could make Chrome hang for more than 30 seconds with plain old HTML Tables :)