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

chore: Use sync.OnceValues to reduce redundant computation #4315

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

qianlongzt
Copy link
Contributor

example

{{- if and (lookPath "mise") (eq .os "linux") }}
{{- output "mise" "completion" "fish" -}}
{{end -}}
time=2025-03-03T16:39:37.974+08:00 level=INFO msg=ReadFile component=system name=/home/qianlongzt/.local/share/chezmoi/home/private_dot_config/fish/completions/empty_mise.fish.tmpl size=101 data="{{- if and (lookPath \"mise\") (eq .os \"linux\") }}\n{{- output \"mis..."
time=2025-03-03T16:39:38.042+08:00 level=INFO msg=Output cmd="/home/linuxbrew/.linuxbrew/bin/mise completion fish" duration=66.693957ms size=696 output="# if \"usage\" is not installed show an error\nif ! command -v usag..." err=<nil>
time=2025-03-03T16:39:38.095+08:00 level=INFO msg=Output cmd="/home/linuxbrew/.linuxbrew/bin/mise completion fish" duration=52.165978ms size=696 output="# if \"usage\" is not installed show an error\nif ! command -v usag..." err=<nil>
time=2025-03-03T16:39:38.096+08:00 level=INFO msg=Lstat component=system name=/home/qianlongzt/.config/fish/completions/mise.fish

@twpayne twpayne merged commit 191c3c1 into twpayne:master Mar 3, 2025
32 checks passed
@twpayne
Copy link
Owner

twpayne commented Mar 3, 2025

Thank you very much for spotting this and for the excellent fix!

@qianlongzt qianlongzt deleted the chore-sync-once branch March 3, 2025 22:05
@twpayne
Copy link
Owner

twpayne commented Mar 9, 2025

Thank you again for this fix. I'd noticed that chezmoi had been slower than I expected for a while, but had not taken the time to investigate why. Your fix here gives a very clear and welcome performance boost. Thank you!

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 this pull request may close these issues.

2 participants