Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 91363 - Efficiency issues with nsObserverTopic, etc
: Efficiency issues with nsObserverTopic, etc
: perf
Product: Core
Classification: Components
Component: HTML: Parser (show other bugs)
: Trunk
: x86 All
: P4 normal with 2 votes (vote)
: Future
Assigned To: Nobody; OK to take it and work on it
: Andrew Overholt [:overholt]
Depends on:
Blocks: 71668
  Show dependency treegraph
Reported: 2001-07-18 14:47 PDT by Randell Jesup [:jesup]
Modified: 2014-04-26 03:20 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description Randell Jesup [:jesup] 2001-07-18 14:47:36 PDT
Mozilla 20010717xx

nsObserverTopic has a few efficiency issues:

1. GetTopic() is a linear search of topics.  Perhaps it should be a hashtable of
some sort.

2. Notify() takes all the keys and values (which are strings), and then adds
them to nsVoidArrays along with a few extra items.  This causes quite a few
allocations (both of strings and nsVoidArray structures), and the Observers
shouldn't be modifying the keys/values anyways.  Perhaps these should be passed
by reference.  (The strings may not duplicate all the storage due to how our
string classes work; here's the code:
  nsString* string = new nsString(aString);
  if (nsVoidArray::InsertElementAt(string, aIndex))
Comment 1 Randell Jesup [:jesup] 2001-07-27 21:30:03 PDT
I dealt with the allocations of VoidArray in bug 90545.  The issues of
allocations of strings still applies.
Comment 2 harishd 2001-10-04 10:44:41 PDT
--> 0.9.6
Comment 3 harishd 2001-10-14 22:14:29 PDT
With fix for bug 96364 GetTopic() ( rather GetEntry() )should not be an issue
since the number of calls to GetEntry() has reduced a LOT.
Comment 4 harishd 2001-10-22 14:59:52 PDT
Lowering the priority based on my previous comment.
Comment 5 harishd 2001-10-30 16:41:03 PST
Out of time :-( Moving to 0.9.7
Comment 6 harishd 2001-11-14 15:45:55 PST
Randell: Is this still an issue?
Comment 7 Randell Jesup [:jesup] 2001-11-14 22:24:44 PST
Yes, I believe so.  Check dbaron's pageload jprof to get an idea if it's important.
Comment 8 harishd 2002-01-16 15:06:14 PST
Out of time. Mass move to 0.9.9
Comment 9 harishd 2002-02-14 10:56:35 PST
Mass moving to 1.1.
Comment 10 Heikki Toivonen (remove -bugzilla when emailing directly) 2002-08-01 12:48:38 PDT
[was 1.1alpha]
Comment 11 Randell Jesup [:jesup] 2011-09-15 17:00:47 PDT
Case 1 is now a hashtable as suggested, and case 2 no longer does the code snippet shown; it inserts fairly directly into an nsCOMArray in nsObserverList, so this is fixed.

Note You need to log in before you can comment on or make changes to this bug.