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

Render manpages asynchronously using a ThreadPoolExecutor #2

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

superatomic
Copy link
Owner

These changes significantly improve the speed of update_cache() by having calls to render_manpage() run in parallel (using concurrent.futures.ThreadPoolExecutor).

This causes a significant time improvement in tldr --update for the user.

On my machine with 12 logical cpu cores (6 physical cpu cores), ThreadPoolExecutor will launch 16 threads (using the calculation (os.cpu_count() or 1) + 4). This results in the following time improvements:

new_tldr -u  268.20s user 410.43s system 646% cpu 1:44.98 total
old_tldr -u  190.29s user 215.99s system  81% cpu 8:20.22 total

This means a cache update now runs 476.49% faster.

@superatomic superatomic merged commit 3bbdcb6 into main Mar 10, 2023
@superatomic superatomic deleted the async_renderer branch March 10, 2023 20:24
@superatomic superatomic added the enhancement New feature or request label Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant