hulu / roku-dev-cli

A command-line developer tool for loading Roku builds
Apache License 2.0
26 stars 8 forks source link

fix(perf): Don't use 100% of CPU for telnet proxy #6

Closed sjbarag closed 5 years ago

sjbarag commented 5 years ago

We currently use read_very_eager in a while True: loop, which means we attempt to loop as quickly as possible. Now we'll wait for a newline or one second, whichever comes first. Everyone's laptop fans will thank them.

Also ensures empty lines don't get printed, which has bothered me for a while now.

sjbarag commented 5 years ago

Tested via htop and sorting by CPU utilization. Under the previous implementation, I'd have one core spike to 100% utilization for the duration of this script's run; now it doesn't even appear in the top ten.

sjbarag commented 5 years ago

@strattonbrazil mind giving me publish permissions? I just registered on pypi.python.org: https://pypi.org/user/sjbarag/