Movatterモバイル変換
[0]ホーム
[Python-Dev] I think my set module is ready for prime time; comments?
Tim Peterstim.one@home.com
Wed, 24 Jan 2001 04:24:26 -0500
[Greg Ewing]> This could be incorporated into PyDict. Instead of storing keys and> values in the same array, keep them in separate arrays and only> allocate the values array the first time someone stores a value other> than 1.[Guido]> Not a bad idea!In theory, but if Vladimir were here he'd bust a gut over the possibly badcache effects on "real dicts" (by keeping everything together, simplyaccessing the cached hash code brings both the key and value pointers intoL1 cache too). We would need to quantify the effect of breaking thatconnection.> (But shouldn't the default value be something else,> like none?)Bleech. I hate the idiom of using a false value to mean "present". d = {} for x in seq: d[x] = 1runs faster too (None needs a LOAD_GLOBAL now).
[8]ページ先頭