Open
Bug 129807
Opened 23 years ago
Updated 2 years ago
nssList_Clone() is O(n^2) if list->sortFunc is not NULL
Categories
(NSS :: Libraries, defect, P2)
Tracking
(Not tracked)
NEW
People
(Reporter: wtc, Unassigned)
Details
Attachments
(1 file)
nssList_Clone() first creates an empty list. Then it steps through the old list and calls nssList_Add() to add the same data to the new list. If list->sortFunc is not NULL, the old list is sorted and nssList_Add() needs to invoke the sort function k times when the new list has k elements. To clone a list with n elements, the sort function will be invoked 0 + 1 + 2 + ... + (n-1) = n*(n-1)/2 times. If list->sortFunc is NULL, nssList_Clone() is O(n) because nssList_Add() is O(1).
Comment 1•23 years ago
|
||
sigh. The list code is really not good, I wrote it to solve a problem, then overused it. I've been thinking of ways to remove dependencies on it (i.e., better ways of solving the problems that nssList is currently being used for). Should this be a 3.4.1 bug? The obvious fix is to clone the list directly instead of using nssList_Add.
Reporter | ||
Comment 2•23 years ago
|
||
Yes, cloning the list directly is the solution. Setting target milestone 3.4.1, priority P2.
Priority: -- → P2
Target Milestone: --- → 3.4.1
Reporter | ||
Comment 3•22 years ago
|
||
Changed the QA contact to Bishakha.
QA Contact: sonja.mirtitsch → bishakhabanerjee
Reporter | ||
Updated•22 years ago
|
Target Milestone: 3.5 → 3.7
Reporter | ||
Comment 5•22 years ago
|
||
Moved to target milestone 3.8 because the original NSS 3.7 release has been renamed 3.8.
Target Milestone: 3.7 → 3.8
Comment 6•21 years ago
|
||
Remove target milestone of 3.8, since these bugs didn't get into that release.
Target Milestone: 3.8 → ---
Updated•19 years ago
|
QA Contact: bishakhabanerjee → jason.m.reid
Updated•18 years ago
|
Assignee: bugz → nobody
QA Contact: jason.m.reid → libraries
Version: 3.4 → 3.3
Comment 7•2 years ago
|
||
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•