|
From: Kalle S. <ka...@gn...> - 2001-03-28 17:19:44
|
Just jumping in here. I've got a lot to do, but I'm alive. Sez Mike Earl: > 2) Another possibility; objects are large, but *pointers* are quite > small. If there are a small number of hex types, keep a dictionary of > the ones being used, and put them in the map instead of creating new > ones. We'd only have 1 copy of any duplicated hexes, which would reduce > the memory required dramatically. Haven't really thought this all the > way through, but it might be useful... Sounds like a Flyweight. > btw: in testing some of this, I found a nice python tidbit. To > initalize a 320x200 array of blank objects, you can just take > > [[None] * 320] * 200 > > This operation is also very, very fast, for some reason. Yeah, but watch out: >>> l = [[None] * 320] * 200 >>> l[0][0] = 1 >>> l[0][0] 1 >>> l[1][0] 1 >>> Check it out: >>> l = map(list, list(((None,)*320,)*200)) >>> l[0][0] = 1 >>> l[0][0] 1 >>> l[1][0] >>> It's almost lisp! Peace, Kalle -- Email: ka...@gn... | You can tune a filesystem, but you Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8) PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD [ Not signed due to lossage. Blame Microsoft Outlook Express. ] |