Closed Bug 372627 Opened 17 years ago Closed 17 years ago

Large Download History Freezes Mozilla

Categories

(Toolkit :: Downloads API, defect)

1.8 Branch
x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 159107

People

(Reporter: alainbryden, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2

When downloading many files sequentially, without clearing out the download manager, Mozilla Firefox will start to freeze for longer and longer each time you download a new item. This seems to be because it has to perform the fairly arbitrary task of sliding all the completed downloads down the list and insert the new item at the top of the list. I'm not sure what algorithm is used to enqueue new downloads, but it must be O(n^2) with the number of downloads in the list, complete and incomplete, or something ridiculous like that. It seems to me the simple task of throwing a new download into a list should take O(1) time.

This happened when I was on Facebook downloading albums. After about 3 albums (180 completed picture downloads in the list), Firefox was performing ridiculously slowly. At first I thought it was the internet connection failing, but it was Firefox failing to respond while it tried to enqueue the next download.

Reproducible: Always

Steps to Reproduce:
1. Manually (or with a macro) ask Firefox to download about 150 items, one after the other. Allow the download manager to develop a large history without cleaning up.
2. Right click and save some element on a page, and immediately try clicking around - you'll observe that Firefox is unresponsive for several seconds.
3. As the download manager develops a larger history, the unresponsiveness will last longer and longer.
Actual Results:  
On my system, after 150 downloads or so, Firefox is visibly unresponsive. It's understandable that on less busy systems, it may not become unresponsive until there is a much larger number of items.

Expected Results:  
The software should take O(1) time to enqueue a single download. It should not matter how many downloads are listed in the history. It takes unit time to add an item to the front of a queue in any reasonable data structure.
Dupe of bug 159107, assuming it is getting moved to the core.
Fixed on trunk with Bug 380250
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Version: unspecified → 2.0 Branch
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.