tldr-c-client: Slow tldr -u (tldr --update)

Expected behavior

tldr -u (tldr --update) should be quick if the local database is up to date.

Actual behavior

tldr takes ~4s and sometimes more. I am not sure if it takes more with an empty local database, couldn’t figure out how to wipe it.

Log, debug output

$ time tldr -u
Successfully updated local database

real	0m4.761s
user	0m0.292s
sys	0m1.941s
$ time tldr -u
Successfully updated local database

real	0m4.146s
user	0m0.279s
sys	0m1.942s
$ time tldr -u
Successfully updated local database

real	0m3.851s
user	0m0.275s
sys	0m1.798s

Environment

  • Operating system - macOS/Linux/Windows (add version if needed) macOS
  • tldr version (tldr --version)
$ tldr --version
tldr v1.5.0 (v1.5.0)
Copyright (C) 2016 Arvid Gerstmann
Source available at https://github.com/tldr-pages/tldr-c-client
  • Installation
$ brew install tldr
Warning: tldr 1.5.0 is already installed and up-to-date.
To reinstall 1.5.0, run:
  brew reinstall tldr

(Template adapted from https://github.com/tldr-pages/tldr-node-client/issues)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Yeah, right now the update process is very “dumb” where it doesn’t do any sort of check to see if the remote archive has been changed at all since the previous update, and so it always just downloads the entire zip (~5MB) and then unpacks it.

I’ve made https://github.com/tldr-pages/tldr/pull/9669 which would present a bit easier method for checking if a new zip is available without having to download the entire zip first, but failing that, we could always fallback to recording the latest commit at https://github.com/tldr-pages/tldr-pages.github.io, though that may have some false positives where the zip archive output is somewhat stable, and a given commit might have been from a documentation or tooling change, and not an actual pages change.