Must it be every time though?
You can save your TW after each input, to ensure you have a point to return to if a later check shows there was an error, or if the system crashes.
But if you can check every 10th time, then you cut your reload issues to 1/10th their current scale - your timing goes from as high as 800ms, to an average better than 80ms. And if there was an issue, you only have to go back at most 10 previous TW saves.
This sounds like each one is already it’s own file? Which sounds to me ideally suited to using node. Convert each file as it currently is, to a node compatible .tid file (or other format if that’s suitable. (“code” is vague, but I understand you may not want to go into detail about their contents)). It would get the content into TW, and then you can edit within TW from there. Depending on the content and your workflows, this may shortcut a lot of tedious data entry.
Any text file (regardless of content) can be made into a valid node-compatible .tid
file with three lines at the top (the third line is blank):
title: __unique_title_here__
type: text/plain
That would get everything into node potentially very quickly, after which further editing and change of type
would be a shorter set of work, I think?