darcs patch: X.H.UrgencyHook: performance fix

Sat Mar 27 21:15:03 CET 2010 Tomas Janousek

On Sat, Mar 27, 2010 at 6:00 PM, Tomas Janousek
Sat Mar 27 21:15:03 CET 2010 Tomas Janousek
* X.H.UrgencyHook: performance fix cleanupUrgents would update the Map in extensible state 2-times the number of visible windows, resulting in excessive memory usage and garbage collection. This seems to make it behave correctly.
Note: this is actually not necessary after the fix to core I just posted, but it should speed things up a little if one has hundreds of visible windows.
If no one objects in 14 days, I will apply this. -- gwern

tomi:
Sat Mar 27 21:15:03 CET 2010 Tomas Janousek
* X.H.UrgencyHook: performance fix cleanupUrgents would update the Map in extensible state 2-times the number of visible windows, resulting in excessive memory usage and garbage collection. This seems to make it behave correctly.
Note: this is actually not necessary after the fix to core I just posted, but it should speed things up a little if one has hundreds of visible windows. -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/
New patches:
[X.H.UrgencyHook: performance fix Tomas Janousek
**20100327201503 Ignore-this: e62c1cdc752c510f2fe1f7dc3bef3db5 cleanupUrgents would update the Map in extensible state 2-times the number of visible windows, resulting in excessive memory usage and garbage collection. This seems to make it behave correctly. ] { hunk ./XMonad/Hooks/UrgencyHook.hs 82 import Control.Applicative ((<$>)) import Control.Monad (when) import Data.Bits (testBit) -import Data.List (delete) +import Data.List (delete, (\\)) import Data.Maybe (listToMaybe, maybeToList) import qualified Data.Set as S
hunk ./XMonad/Hooks/UrgencyHook.hs 375 shouldSuppress sw w = elem w <$> suppressibleWindows sw
cleanupUrgents :: SuppressWhen -> X () -cleanupUrgents sw = mapM_ clearUrgency =<< suppressibleWindows sw +cleanupUrgents sw = do + sw' <- suppressibleWindows sw + adjustUrgents (\\ sw') >> adjustReminders (filter $ (not . (`elem` sw') . window))
Perhaps use notElem ? -- Don

Hello, On Mon, Mar 29, 2010 at 09:43:57AM -0700, Don Stewart wrote:
Sat Mar 27 21:15:03 CET 2010 Tomas Janousek
+ adjustUrgents (\\ sw') >> adjustReminders (filter $ (not . (`elem` sw') . window)) Perhaps use notElem ?
Yes, sure, I totally forgot about that :-). Is it easier if the one who pushes that patch just makes another one with this change or shall I post a fixed patch? (I'm not that familiar with the usual darcs practices, sorry.) -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

2010/3/29 Tomáš Janoušek
Hello,
On Mon, Mar 29, 2010 at 09:43:57AM -0700, Don Stewart wrote:
Sat Mar 27 21:15:03 CET 2010 Tomas Janousek
+ adjustUrgents (\\ sw') >> adjustReminders (filter $ (not . (`elem` sw') . window)) Perhaps use notElem ?
Yes, sure, I totally forgot about that :-). Is it easier if the one who pushes that patch just makes another one with this change or shall I post a fixed patch? (I'm not that familiar with the usual darcs practices, sorry.)
It's best if you make the change, and then record it using 'darcs amend-record'; then re-'darcs send' it. This keeps the history clean with a single push of a single patch for a single change. Darcswatch is smart enough to know that the old patch is automatically 'obsolete' and it only should track the new patch made using 'amend-record'. -- gwern

* On Monday, March 29 2010, Gwern Branwen wrote:
It's best if you make the change, and then record it using 'darcs amend-record'; then re-'darcs send' it. This keeps the history clean with a single push of a single patch for a single change. Darcswatch is smart enough to know that the old patch is automatically 'obsolete' and it only should track the new patch made using 'amend-record'.
-- gwern
This can lead to confusion for other people who have applied the older patch, but I doubt there are many, and they would be following this conversation anyways. -- Adam

* On Saturday, March 27 2010, Tomas Janousek wrote:
Sat Mar 27 21:15:03 CET 2010 Tomas Janousek
* X.H.UrgencyHook: performance fix cleanupUrgents would update the Map in extensible state 2-times the number of visible windows, resulting in excessive memory usage and garbage collection. This seems to make it behave correctly. + sw' <- suppressibleWindows sw + adjustUrgents (\\ sw') >> adjustReminders (filter $ (not . (`elem` sw') . window))
While we're at performance considerations for large numbers of windows, it might be helpful to rearrange UrgencyHook operate on S.Set instead of []? -- Adam

Hello, On Mon, Mar 29, 2010 at 01:25:55PM -0400, Adam Vogt wrote:
While we're at performance considerations for large numbers of windows, it might be helpful to rearrange UrgencyHook operate on S.Set instead of []?
I wanted to rewrite it today, but I noticed that there's this focusUrgent operation that's supposed to focus the most recently urgent window -- the list is there to maintain the order. I guess I'll just leave it as it is :-). Regards, -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

Hello, updated patch attached. -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

This 1-patch bundle was just applied to http://code.haskell.org/XMonadContrib:
20100330141341 Tomas Janousek
participants (6)
-
Adam Vogt
-
darcswatch@nomeata.de
-
Don Stewart
-
Gwern Branwen
-
Tomas Janousek
-
Tomáš Janoušek