On 10/13/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > > an object with 70ish attributes makes. FWIW, I'm doing the exact > > opposite of XP, and building to handle 300,000 to 600,000 objects... > > As a matter of interest why do you need so many in RAM at once? > Its very unusual to require that many and there are techniques to > minimise the space by using 'phantom' objects and only pulling in > the data as needed (so called 'late evaluation'). > > If you tell us more about the problem context we might be able to > help make the solution simpler. > > Alan G. >
Hi Alan, First off, may I say, don't do mathematics when tired. I've revised my estimates. Problem is a certain file. http://ipodlinux.org/ITunesDB I'm creating an object for each header (for want of a better word.) A song is described by an object with several children objects, each one has certain attributes. Until I figure out a way to refactor this, I'm working on layers of abstraction. database object (contains controls, songs, podcasts, playlists etc) ^ ^ ^ composite objects (each object is composite of several base objects) ^^^^^^ base objects (objects derived from binary data) ^^^^^^^^^^ iTunesDB I've got 400ish songs, and 40 playlists which equals about 5200 headers, and hence header objects. So, a 60Gb iPod can store .... err, 15,000 songs (assuming that an average mp3 is around 4Mb). So then I did some wild guessing, and assuming that the ratio of songs to playlists remained roughly the same, then I'll make another assumption that the ratio of song & playlists to headers would also remain the same, so playlists :songs : headers is around 1 : 10 : 130. Each song is comprised of around minimum 3, can be 8/9 headers, each playlist is comprised of roughly 2n objects per song listing, and a certain amount associated with the playlist. (This is really rough). So, 15,000 songs equates to 1500 playlists (including smart playlists) , and 180,000 objects/headers. Now, I've thought about doing this various ways, but creating a coherent and usable data structure while keeping the structure of the binary file easily recreatable is what I'm after. So, in doing so, I end up with a whole lot of objects, but it's a whole lot of objects I can easily use. I'll stick the code up on the web shortliesh, I'm refactoring the file reading at the mo, as I initially wrote it only to read. Regards, Liam Clarke PS Can you recommend a decent place for a hobbyist to learn about late evaluation etc? _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor