Re: [Banshee-List] Track dictionary in TrackListDatabaseModel
- From: Mike Urbanski <michael c urbanski gmail com>
- To: banshee-list gnome org
- Subject: Re: [Banshee-List] Track dictionary in TrackListDatabaseModel
- Date: Sat, 05 Jan 2008 07:24:58 -0600
On Sat, 2008-01-05 at 12:33 +0100, LCID Fire wrote:
> I was looking into TrackListDatabaseModel and wondered why the tracks
> are managed in a Dictionary?
This is actually a good choice.
Look ups and inserts into a hash table are a near O(1) operations on
average. Look ups are O(n) in theory, but you're not likely to see
that.
> I'd say it would make more sense to have this as a list[...]
The major issue is that in List<T>s (List<T>-s? LisTees?) is that their
element lists must be traversed to find elements / indexes. So, look
ups and adds are O(n) operations.
Also, considering that db key values do not necessarily correspond to
list index values, you would run into a potentially memory intensive
data sparsity issue.
~Mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]