--- Fredrik Tolf <fredrik@...> wrote:
> On Fri, 2007-01-05 at 02:52 +0100, Fredrik Tolf wrote:
> > On Thu, 2007-01-04 at 13:14 -0600, Richard Laager wrote:
> > > On Thu, 2007-01-04 at 03:21 +0100, Fredrik Tolf wrote:
> > > [...]
> > > > merely annoying. Right now, Gaim 2 has been taking over 8 minutes
> of CPU
> > > > time trying to add ~6300 users, with no sign of stopping any time
> > > > Needless to say, that goes beyond merely being annoying. Is there
> a way
> > > > to fix this?
> > > [...]
> > > Are you calling gaim_conv_chat_add_user() or
> > > Adding them one at a time is going to result in 3 * N lists being
> > > created and destroyed, which could be the source of your problem.
> > Indeed, this was the problem. I had no idea that
> > gaim_conv_chat_add_users existed. :) Is it new in Gaim 2, or did it
> > exist previously as well? Anyways, thanks for enlightening me!
> On another note about large chat rooms, it seems that in rooms where the
> number of users approach 10000, the operations of adding and removing
> single users the join and leave become painfully slow. It appears that
> it can take a couple of hundred millseconds to add or remove a single
> Since users join and leave frequently, the UI becomes almost
> unresponsive because of that. Is there some optimized API that I can use
> in these situations as well?
One workaround can be to update the user-list at most once every X seconds
(whichever value of X you think is appropriate). So:
1. Once a user joins/leaves the room, you create a list with that user and
start a timer (g_timeout_add).
2. If another user joins/leaves the room, you see if the timer for that
room is still alive. If it is, you add the user in the list. If not, you
3. The timeout callback calls add-users and remove-users functions in
libgaim and deactivates the timer.
You could probably consider an idle-callback (g_idle_add) instead of a
timeout-callback. I am not sure if that'd help.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around