Adium

Ticket #10135 (closed defect: fixed)

Opened 3 months ago

Last modified 2 months ago

Contact list search slow on older Macs

Reported by: darmok Assigned to: nobody
Priority: normal Milestone: SVN issues
Component: Contact List Search Version: 1.3b3
Severity: minor Keywords:
Cc: Patch: None
Pending: 0

Description

In the release versions of Adium, you could *quickly* find a contact in the Contact window by simply typing a character or two then hitting return to open the message window.

This is broken in 1.3beta. Now, when you hit a character, you have to wait for the Contact window to reflow to show the Find field. Then you type. Then you wait again, while the window reflows, showing some random collection of contacts. Then you have to peruse the results with the mouse and finally double-click on the contact you want. This combination makes Adium extrememly difficult to use, especially for the handicapped.

This new Find feature is cute but it's so abysmally slow, it's unusable. It needs to be sped up. The search field needs to be anchorable to the beginning of the contact name. And better - a preference needs to be available to revert Adium to the normal behavior.

Change History

06/16/2008 12:54:31 PM changed by zacw

What kind of computer are you on that it's "abysmally slow"?

The suggestion I got out of this semi-insulting ticket is that perhaps we should allow type-ahead normally, and use the find dialog when it is brought forward.

06/16/2008 01:30:47 PM changed by alin0s

It works fine for me on my Core Duo MacBook Pro. What kind of computer are you running. Please describe the computer and its setup.

Also when writing tickets please write from a neutral view, please do not insult the software, that is why it is BETA, it will have bugs, we are here to fix them.

(follow-up: ↓ 4 ) 06/16/2008 03:43:52 PM changed by darmok

Sorry; config info was accidentally cut as I was editing.

Not sure what you mean by insulting. I stated the prior behavior and the new, the problem I'm experiencing with the new, and suggested what areas needed improvement. Thought it was pretty reasonable, myself..

This problem is occuring on both Macs (config below). Please note that by "abysmally slow" I'm referring not only to the reflow speed but to the new laborious method. eg: two characters and hit return vs two characters, move hand to mouse, scroll around, wait for the scroll to finish, then double-click.

Also - I've now discovered that when all Contacts are being shown, the page down/up buttons no longer scrolls the window as one would expect. Hitting either reflows the window, but only to bring up the Find field then no further response.

My config:
300-MHz PowerMac G3 B&W w/ 640 MB RAM, OS X 10.4.11
800-MHz iBook G4 w/ 640 MB RAM, OS X 10.4.11
Accounts: 3 AIM, 2 ICQ, 2 GoogleTalk, 1 MSN, 3 Yahoo (related, so two are disabled).
Over 200 contacts.

(in reply to: ↑ 3 ) 06/16/2008 03:53:02 PM changed by alin0s

Replying to darmok:

Sorry; config info was accidentally cut as I was editing. Not sure what you mean by insulting. I stated the prior behavior and the new, the problem I'm experiencing with the new, and suggested what areas needed improvement. Thought it was pretty reasonable, myself.. This problem is occuring on both Macs (config below). Please note that by "abysmally slow" I'm referring not only to the reflow speed but to the new laborious method. eg: two characters and hit return vs two characters, move hand to mouse, scroll around, wait for the scroll to finish, then double-click. Also - I've now discovered that when all Contacts are being shown, the page down/up buttons no longer scrolls the window as one would expect. Hitting either reflows the window, but only to bring up the Find field then no further response. My config:
300-MHz PowerMac G3 B&W w/ 640 MB RAM, OS X 10.4.11
800-MHz iBook G4 w/ 640 MB RAM, OS X 10.4.11
Accounts: 3 AIM, 2 ICQ, 2 GoogleTalk, 1 MSN, 3 Yahoo (related, so two are disabled).
Over 200 contacts.

Adium as it gets newer becomes more and more CPU intensive. the G3 seems like a slightly paltry config for this software. the G4 also seems slightly paltry. I suggest you try this out on a Leopard machine, if it works fine on leopard then there might be something up with your machine.

also i think the new method is easier. all the scrolling around and double clicking was not easy... this i type in a few chars and its done...

over 200 contacts on those configs COULD be causing issues. try making a new adium profile and adding just 20 contacts. if it works with that then your machine might be to blame

06/16/2008 03:58:38 PM changed by zacw

I'm pretty sure I know where the page up/down being caught incorrectly is in the code. That shouldn't behave as such. As for the "speed" of it, you can use the keyboard's up/down to navigate from the search field to the contact list to grab the contact quickly. The search won't refine enough to have a small list if you've got that many contacts, this is true. Like I said: it may be worth considering type-ahead by default, and the search bar when it's opened.

(follow-ups: ↓ 8 ↓ 15 ) 06/16/2008 04:40:59 PM changed by darmok

IMO, text-based instant messaging should not require a supercomputer to be usable. sigh. Religious argument. Ok...

Went poking around the prefs and found "animate changes" (prefs/advanced/contactlist). When it is *unchecked*, the list reflow as I type in the find field is quite fast / instantaneous. When it is *checked*, the reflow is very slow. On my Smurf, it's slow as expected (I guess) during normal window changes (show/hide all contacts, for example), but when that Find field is shown, it's much much slower. Obviously, I can and will avoid this speed issue by leaving "animate changes" unchecked. But it would seem to me that the reflow should occur at the same speed, regardless of the presence of that find field. Um... Perhaps the speed problem could be reduced if it didn't reflow the window for *every* character typed into that field? Perhaps, like Finder, type a few chars fast and it does only one redraw.

re over 200 contacts. Yes, reducing the number of contacts fixes the speed problem in that there's that much less window to draw. But hey, it's only a 17" crt. LOL

re using keyboard up/down arrow. My impression was that you had to mouse-click to get out of the find field. I see now that the arrow key does work, but if I hit it while the reflow is occurring or too soon thereafter, the key stroke is lost. Back to the type-ahead problem?

And thank you for your patience with all this. I realize I'm pushing the performance boundries by using such an old system. ... It has its pros and cons...

- Dan.

06/16/2008 04:43:24 PM changed by Catfish_Man

List drawing has some room for optimization last I checked (unnecessary malloc()s in drawRect for example). The really key bit would be to create something that automatically filters and unfilters the list rapidly so that it can be sharked properly.

(in reply to: ↑ 6 ) 06/16/2008 04:46:52 PM changed by alin0s

Replying to darmok:

IMO, text-based instant messaging should not require a supercomputer to be usable. sigh. Religious argument. Ok... Went poking around the prefs and found "animate changes" (prefs/advanced/contactlist). When it is *unchecked*, the list reflow as I type in the find field is quite fast / instantaneous. When it is *checked*, the reflow is very slow. On my Smurf, it's slow as expected (I guess) during normal window changes (show/hide all contacts, for example), but when that Find field is shown, it's much much slower. Obviously, I can and will avoid this speed issue by leaving "animate changes" unchecked. But it would seem to me that the reflow should occur at the same speed, regardless of the presence of that find field. Um... Perhaps the speed problem could be reduced if it didn't reflow the window for *every* character typed into that field? Perhaps, like Finder, type a few chars fast and it does only one redraw. re over 200 contacts. Yes, reducing the number of contacts fixes the speed problem in that there's that much less window to draw. But hey, it's only a 17" crt. LOL re using keyboard up/down arrow. My impression was that you had to mouse-click to get out of the find field. I see now that the arrow key does work, but if I hit it while the reflow is occurring or too soon thereafter, the key stroke is lost. Back to the type-ahead problem? And thank you for your patience with all this. I realize I'm pushing the performance boundries by using such an old system. ... It has its pros and cons... - Dan.

todays computers are no super computers... but it is nice when older machines are kept in the support chain...

i believe that your computers graphics card may be over stressed possibly... since reducing the number of contacts fixes the problem...

so it is definitely a drawing issue...

possibly even a drawing bug...

06/16/2008 04:47:41 PM changed by Catfish_Man

alin0s: the gpu is not used for Adium's contact list animation.

More generally, guessing about performance issues is a very bad idea. Testing with a profiler is the only way to be sure.

06/17/2008 08:30:54 AM changed by jas8522

  • summary changed from Contact list search doesn't work well to Contact list search slow on older Macs.
  • severity changed from normal to minor.
  • milestone set to Adium X 1.3.

Rather than focusing on optimization techniques that may or may not get done, why don't we just do the obvious to fix this. Could we not just disable animation in the same way that it is done when the check box in advanced preferences is unchecked while completing a search?

On my MBP I see no difference between having that checked or not while doing a search, so it's not like it loses any visual appeal. This way we can accomodate those with slower CPU's while at the same time only requiring a small amount of work to be done (assumably) compared to contact list rendering optimizations.

06/17/2008 11:51:12 AM changed by Catfish_Man

That seems like a rather sane optimization to me, although I still think it could use sharking :P

06/17/2008 05:59:56 PM changed by evands

I agree strongly with jas about disabling animation during the search... and that with catfish_man that it could use sharking :)

06/17/2008 06:05:50 PM changed by evands

Hold on... we already disable animation when the filter bar is shown. We have since it was initially committed in [22859].

06/17/2008 06:15:03 PM changed by evands

  • status changed from new to closed.
  • resolution set to fixed.

(In [24010]) Fix breakage of the contact list animating setting whenever an object's contact list preference (such as its expanded status!) changes. Fixes suppression of animation during list filtering. Fixes #10135

(in reply to: ↑ 6 ) 06/17/2008 07:05:35 PM changed by evands

For the record, while I found the previous implementation without disabling animation completely acceptable on my 2.33 ghz core II duo, I can tell that with [24010] searching is snappier. Thanks for the careful testing, Dan.

06/17/2008 07:07:13 PM changed by Catfish_Man

I still see a noticeable hesitation on the first character or two. Shark indicates that 18.8% (!!) is spent in objc_msgSend.

06/17/2008 07:21:44 PM changed by jas8522

Catfish_Man: I can see this as well, but only on the first character, and it's still less than 1 second in length. I do have a large number of contacts to search through, and I would assume the length of the delay is dependent on that vs CPU power.

06/17/2008 07:24:38 PM changed by Catfish_Man

http://dscoder.com/menurebuildlag.png <-- we should be able to speed up 40% or so if we defer rebuilding the contact menu on sort

06/17/2008 07:37:50 PM changed by Catfish_Man

OK, Zac and I discussed this and I believe the correct fix is to make sortContactList aware of delayed notifications for list objects. I'll investigate this and implement it if correct on the bus this evening.

06/17/2008 08:24:16 PM changed by Robby

  • component changed from Adium UI to Contact List Search.

06/17/2008 09:48:23 PM changed by Catfish_Man

I'm wrong. The sortContactList calls are coming *from* delayed list updating. We'll need to investigate deferring menu building in some other way. Maybe stick it on a half second delay from the last sort.

06/18/2008 12:24:21 AM changed by Catfish_Man

This speeds things up massively, but it's also conceptually Wrong as Peter points out. We shouldn't be updating the menu at all, there's no reason to. I'm just not sure how to implement that.

Index: Frameworks/Adium Framework/Source/AIContactMenu.h
===================================================================
--- Frameworks/Adium Framework/Source/AIContactMenu.h	(revision 24010)
+++ Frameworks/Adium Framework/Source/AIContactMenu.h	(working copy)
@@ -13,6 +13,9 @@
 @interface AIContactMenu : AIAbstractListObjectMenu <AIListObjectObserver> {
 	AIListObject			*containingObject;
 	
+	//Rebuilds in response to sorting are deferred half a second to avoid blocking the UI (particularly when using list searching)
+	NSTimer					*coalesceTimer;
+	
 	id						delegate;
 	BOOL					delegateRespondsToDidSelectContact;
 	BOOL					delegateRespondsToShouldIncludeContact;	
Index: Frameworks/Adium Framework/Source/AIContactMenu.m
===================================================================
--- Frameworks/Adium Framework/Source/AIContactMenu.m	(revision 24010)
+++ Frameworks/Adium Framework/Source/AIContactMenu.m	(working copy)
@@ -85,7 +85,14 @@
 {
 	AIListObject *changedObject = [notification object];
 	if (changedObject == containingObject) {
-		[self rebuildMenu];
+		if(coalesceTimer)
+			[coalesceTimer invalidate];
+		
+		coalesceTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5
+														  target:self
+														selector:@selector(rebuildMenu:)
+														userInfo:nil
+														 repeats:NO] retain];
 	}
 }
 
@@ -136,8 +143,16 @@
 								 [delegate contactMenuShouldDisplayGroupHeaders:self]);
 	
 	[delegate contactMenu:self didRebuildMenuItems:[self menuItems]];
-}	
+}
 
+//For coalesced rebuilds
+- (void) rebuildMenu:(NSTimer *)timer
+{
+	[self rebuildMenu];
+	[coalesceTimer release]; 
+	coalesceTimer = nil;
+}
+
 /*!
  * @brief Inform our delegate of menu selections
  */

06/18/2008 12:49:46 AM changed by Catfish_Man

Digging further, this is a regression from http://trac.adiumx.com/changeset/22570, which introduced the update-on-sort

06/18/2008 12:51:23 AM changed by Catfish_Man

Erm, not it's not. It was even worse before then. Very sorry for the bugspam!

06/18/2008 01:06:43 AM changed by Catfish_Man

New patch. This tells AIContactMenu to not update in response to sorting if it's the root contact list (AIContactMenu represents this as a nil containgObject). This seems to be safe to me, since a) it's the root. It itself can't get sorted somewhere else, and b) AIContactMenu does its own sorting, so it shouldn't care about the ordering of its contents, merely their existence/visibility/status. I'm not completely convinced I'm not missing something though, hence posting here instead of committing it.

Index: Frameworks/Adium Framework/Source/AIContactMenu.m
===================================================================
--- Frameworks/Adium Framework/Source/AIContactMenu.m	(revision 24010)
+++ Frameworks/Adium Framework/Source/AIContactMenu.m	(working copy)
@@ -84,7 +84,7 @@
 - (void)contactOrderChanged:(NSNotification *)notification
 {
 	AIListObject *changedObject = [notification object];
-	if (changedObject == containingObject) {
+	if (changedObject && changedObject == containingObject) {
 		[self rebuildMenu];
 	}
 }
@@ -136,7 +136,7 @@
 								 [delegate contactMenuShouldDisplayGroupHeaders:self]);
 	
 	[delegate contactMenu:self didRebuildMenuItems:[self menuItems]];
-}	
+}
 
 /*!
  * @brief Inform our delegate of menu selections

06/21/2008 12:33:03 AM changed by catfish_man

(In [24028]) Avoid rebuilding the contact menu unnecessarily. Refs #10135. Please test the menubar duck heavily after this change, as I am not 100% certain of its correctness

06/26/2008 09:58:58 PM changed by Robby

  • milestone changed from Adium X 1.3 to SVN issues.

06/30/2008 04:50:53 PM changed by darmok

Wow! In 1.3b5, The Duck is snappy now! Thanks!!!!