File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -155,13 +155,12 @@ func overloaded(elems, buckets int) bool {
155155
156156func (ht * hashtable ) grow () {
157157 // Double the number of buckets and rehash.
158- // TODO(adonovan): opt:
159- // - avoid reentrant calls to ht.insert, and specialize it.
160- // e.g. we know the calls to Equals will return false since
161- // there are no duplicates among the old keys.
162- // - saving the entire hash in the bucket would avoid the need to
163- // recompute the hash.
164- // - save the old buckets on a free list.
158+ //
159+ // Even though this makes reentrant calls to ht.insert,
160+ // calls Equals unnecessarily (since there can't be duplicate keys),
161+ // and recomputes the hash unnecessarily, the gains from
162+ // avoiding these steps were found to be too small to justify
163+ // the extra logic: -2% on hashtable benchmark.
165164 ht .table = make ([]bucket , len (ht .table )<< 1 )
166165 oldhead := ht .head
167166 ht .head = nil
You can’t perform that action at this time.
0 commit comments