Skip to content

history: avoid slow "builtin history" dumps in forked processes on macOS - #722

Merged
akinomyoga merged 1 commit into
akinomyoga:masterfrom
dfherr:fix-history-dump-tz-macos
Sep 5, 2026
Merged

akinomyoga merged 1 commit into
akinomyoga:masterfrom
dfherr:fix-history-dump-tz-macos

Conversation

@dfherr

@dfherr dfherr commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

My ~20k entry history took 4 seconds to load on macOS mostly caused by this bug and compounded by #721

This was caused due to history calling localtime for every entry when called through a fork due to Apple's libc/libnotify behavior. Setting an empty TZ fixes this

time history >/dev/null # -> fast
time ( history >/dev/null ) # -> slow
time ( TZ= history >/dev/null ) # -> fast

With both fixes applied history load time went from 4s to 50ms.

Comment thread src/history.sh Outdated
Comment thread src/history.sh Outdated
@akinomyoga
akinomyoga force-pushed the fix-history-dump-tz-macos branch from 865ef64 to 1125a91 Compare September 5, 2026 10:14
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
@akinomyoga
akinomyoga force-pushed the fix-history-dump-tz-macos branch from 1125a91 to c2746d5 Compare September 5, 2026 10:14
@akinomyoga
akinomyoga merged commit 69ee058 into akinomyoga:master Sep 5, 2026
4 checks passed
@akinomyoga

Copy link
Copy Markdown
Owner

Thanks. I've merged this after making adjustments.

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