Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set data structure - Something to consider to save memory #1

Open
finnbear opened this issue Jun 15, 2020 · 0 comments
Open

Set data structure - Something to consider to save memory #1

finnbear opened this issue Jun 15, 2020 · 0 comments

Comments

@finnbear
Copy link

set: map[interface{}]bool{},

You should consider using an empty struct (struct{}) instead of a boolean (bool) as the map value because it won't occupy any memory. You don't actually use the value of the boolean because you check the ok return value from the map access to see if the key is in the set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant