KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm looking for a go language capability similar to the "dictionary" in python to facilitate the conversion of some python code. EDIT: Maps worked quite well for this de-dupe application. I was able to condense 1.3e6 duplicated items down to 2.5e5 unique items using a map with a 16 byte string index in just a few seconds. The map-related code was simple so I've included it below. Worth noting that pre-allocation of map with 1.3e6 elements sped it up by only a few percent: var m = make(map[string]int, 1300000) // map with initial space for 1.3e6 elements ct, ok := m[ax_hash] if ok { m[ax_hash] = ct + 1 } else { m[ax_hash] = 1 }
Tags (comma-separated)
Save Edits
Cancel