Skip to content

Commit

Permalink
runtime: initialize itab.hash always
Browse files Browse the repository at this point in the history
We weren't initializing this field for dynamically-generated itabs.
Turns out it doesn't matter, as any time we use this field we also
generate a static itab for the interface type / concrete type pair.
But we should initialize it anyway, just to be safe.

Performance on the benchmarks in CL 44339:
benchmark               old ns/op     new ns/op     delta
BenchmarkItabFew-12     1040585       26466         -97.46%
BenchmarkItabAll-12     228873499     4287696       -98.13%

Change-Id: I58ed2b31e6c98b584122bdaf844fee7268b58295
Reviewed-on: https://go-review.googlesource.com/44475
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
  • Loading branch information
randall77 committed Aug 15, 2017
1 parent 04d6f98 commit fcf445d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ imethods:
m.fun[0] = 0
return iname
}
m.hash = typ.hash
return ""
}

Expand Down

0 comments on commit fcf445d

Please sign in to comment.