Merge pull request #422 from svanharmelen/f-shaving-off-some-cpu-cycles

helper/schema: Shaving off some unneeded calls, saving CPU cycles
This commit is contained in:
Mitchell Hashimoto 2014-10-20 23:13:18 -07:00
commit 428cce2478
1 changed files with 3 additions and 5 deletions

View File

@ -349,12 +349,10 @@ func (d *ResourceData) getSet(
var indexMap map[int]int
if len(parts) > 0 {
indexMap = make(map[int]int)
}
// Build the set from all the items using the given hash code
for i, v := range list {
code := s.add(v)
if indexMap != nil {
// Build the set from all the items using the given hash code
for i, v := range list {
code := s.add(v)
indexMap[code] = i
}
}