Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created June 23, 2015 10:17
Show Gist options
  • Save hackintoshrao/459b61ea2f6ef0dd6292 to your computer and use it in GitHub Desktop.
Save hackintoshrao/459b61ea2f6ef0dd6292 to your computer and use it in GitHub Desktop.
Functions in which elements from maps and structs are accessed and added and later tested for their benchmark in a test file ,here is the link of the code form the repo https://github.com/Karthic-Hackintosh/Codes-From-My-Blog-posts/blob/master/121/bench1/mapAndStructAdd.go
package gobench
func GoMapAdd() {
m := map[int]int{0: 0, 1: 1}
_ = m[0] + m[1]
}
func GoStructAdd() {
m := struct{ a, b int }{0, 1}
_ = m.a + m.b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment