diff options
author | Sibi Prabakaran <sibi@psibi.in> | 2020-06-05 16:55:52 +0530 |
---|---|---|
committer | Sibi Prabakaran <sibi@psibi.in> | 2020-06-05 16:55:52 +0530 |
commit | 878db39080607ba476ba8d8f547ad28259efb6a9 (patch) | |
tree | 2458ce512885d6ca527e14e9c8751458e4afe320 /changelog.md | |
parent | b15bb7c20b11a9f148c4757caba7167ee66492fc (diff) | |
download | xmobar-878db39080607ba476ba8d8f547ad28259efb6a9.tar.gz xmobar-878db39080607ba476ba8d8f547ad28259efb6a9.tar.bz2 |
Optimize date plugin
We avoid calling getTimeZone for each of the time the date has to be
updated. Instead, it's computed once at the start and re-used for each
invocation.
Looking at the implementation of 'getTimeZone', we can see that it's
very expensive:
https://www.stackage.org/haddock/lts-15.15/time-1.9.3/src/Data-Time-LocalTime-Internal-TimeZone.html#getTimeZone
It calls a C FFI each time to get the time
zone (getTimeZoneCTime). This is something which we can avoid and the
MR implements that.
I have been using my xmobar with this patch and the result has been
quite good. My xmobar CPU usage has used to hit 3~7%
intermittently. With this MR, It hits only 0.7% intermittently which
is nice. :-)
Diffstat (limited to 'changelog.md')
-rw-r--r-- | changelog.md | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index e77af85..5a02fc4 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,9 @@ _New features_ - New plugin `HandleReader` for reading data from a Haskell `Handle`. This is useful if you are running xmobar from within a Haskell program. - Build with ghc 8.10 allowed. + - Optimize date plugin by avoiding calling getTimeZone for each of + the time the date has to be updated. Instead, it's computed once + at the start and re-used for each invocation. ## Version 0.33 (February, 2020) |