Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very high CPU usage when piping #48

Open
widogg opened this issue Mar 26, 2024 · 2 comments · May be fixed by #70
Open

Very high CPU usage when piping #48

widogg opened this issue Mar 26, 2024 · 2 comments · May be fixed by #70

Comments

@widogg
Copy link

widogg commented Mar 26, 2024

Hi! First time user, I just found this (pretty cool) tool and started using it right away.

I noticed a high CPU usage, which I think might be related to #17.

I'm using dpkg.log here as an example, but happen with other files too. When I do tl /var/log/dpkg.log, I have very low CPU usage and I can see the app normally, like this
image

However, if I do cat /var/log/dpkg.log | tl, I get a very VERY high cpu usage
image

Sorry the command is not fully displayed, but it definetly running tl here.

Also, I have to double ctrl+c to exit, which throws this error
image

@Ins1nuatE
Copy link

I have the same problem, double ctrl+c to exit, and the terminal will display inputs of my mouse, like this
2024-08-27_11-08

I found add line sys.exit() in this function can fix this problem(exclude high cpu usage). I am a beginner of python, not really sure if this is the right modification.

@mattviasat
Copy link

I have this problem.

$ tl --version
tl, version 1.4.0
$ echo '{"foo": "bar"}' > /tmp/log.json
$ cat  /tmp/log.json |tl

Uses 100% CPU on both Mac or Linux.

mckaymatt added a commit to mckaymatt/toolong that referenced this issue Jan 23, 2025
Insert a small sleep when polling stdin

Textualize#48
@mckaymatt mckaymatt linked a pull request Jan 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants