tigrawap / slit

slit - a modern PAGER for viewing logs, get more than most in less time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Big File Behavior

haydenflinner opened this issue · comments

Before the following feedback, I'd like to say that I am so glad that I found this repo. I have been looking for over a year for a project like this, as I knew I couldn't be the only one unsatisfied by less but not wanting to buy a closed source log viewer. This even has a feature that I knew I wanted but would have settled without, the highlighting / filtering. It's fleshed out in a way more intuitive way than I probably would have come up with. I've started implementing from scratch a similar project probably twice in the last two years, and tried modifying other pagers once or twice as well. This project is the closest one I've seen to what I'd like!

Now, on to my initial tests with the pager, which unfortunately show that I can't use this tool just yet.

ls -lah gigabyte.txt
-rw-r--r-- 1 hayden users 3.0G Oct  7 20:36 gigabyte.txt

./slit_linux_amd64 gigabyte.txt

Already, slit has started doing something which less does not. I see it reading through the entire file to determine line numbers; This pegs the CPU to 100%, which is something that I prefer it not do. I would prefer if it only read essentially what I asked it to, whether by scrolling or by searching.

Luckily, it doesn't seem to try to keep the whole file in memory, which is good. Now, my fan has gone off, it has read in the whole file (which would not be possible with some production logs I have seen, unfortunately).
I try this: /my search string which doesn't appear

Which freezes the program and again we're back to 100% CPU. This is fine, less is also unresponsive when searching. The only problem is that "CTRL+C" does not interrupt the search and bring the program back to life. Nor does CTRL+D, and CTRL+Z is apparently hooked because I can't background this process, either. The only option is to go to another terminal and SIGTERM it.

If you have any pointers as to where I would start implementing the large-file behavior that I'm looking for (in terms of loading only what is needed), I would greatly appreciate it. The CTRL+C behavior I think you might look at as a bug, and may want to fix yourself as I am not experienced with Go, but if not, I will also try fixing that while I'm tinkering.