I have been making a Web UI to look into very large (up to 10,000-150,000 lines) txt files. I have been using Ruby on Rails to do this and the interface I have has come along well enough. I am currently running into a problem related to the large size of these files. Currently, when a user selects a file to display, it reads the entire contents of that file (line by line) into a scrollable element.
With the large files, this causes the website to hang a little until it finishes and hang even longer if the user wants to choose a new file (this confuses me a bit more, maybe I need to flush the element of its contents first or something?).
Do you see a way to speed up user experience? My only thoughts are loading only part of the file at a time. The most convenient way I see this implemented is just to read more of the file to the div when the user scrolls close to the bottom of the file. I am not really sure this is a good solution because of how the website hangs when switching files.
An ideal solution might be to load only the visible part of the file to the div at a time, but I am unsure how I would accomplish this.
Any suggestions?