tldr-pages / tldr-python-client

:snake: Python command-line client for tldr pages 📚
https://pypi.org/project/tldr/
MIT License
599 stars 95 forks source link

command execute too slow #8

Closed Maslino closed 6 years ago

Maslino commented 9 years ago

to fetch corresponding page from remote repository every time is very slow.

Anmol-Singh-Jaggi commented 8 years ago

So, what solution do you suggest?

bwh1te commented 8 years ago

It is not client issue. Client only downloads data from source. Low speed of execution is only dues to network interaction. Maybe owner should close this issue?

Maslino commented 8 years ago

a page cache may be needed

bwh1te commented 8 years ago

Yep, I think too. Related issue: https://github.com/tldr-pages/tldr-python-client/issues/15

Anmol-Singh-Jaggi commented 8 years ago

If only this project was written using Python3, we could have used the in-built cache decorator which would have allowed us to implement caching by literally adding just one line to the source code.

bwh1te commented 8 years ago

tldr is not working permanently like a daemon. In other words, anytime you execute tldr command_name, you have a new instance of application with empty LRU cache. So it won't help.

I think we need to create some dir like ~/.tldr/cache during installation and store server answers there. And doing requests with If-Modified header. But answer size is not so big... More time will to take connection to server, than get small text response... We may not to request server each time, but how we can know that our cache is up to date?

So cache is important but I guess not to accelerate each command. Just for case when server is not available.

Anmol-Singh-Jaggi commented 8 years ago

Good idea! I'll implement it when I get the time.

felixonmars commented 6 years ago

Implemented in newer versions.