Skip to content

Commit

Permalink
Optimized tait parameters copying.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaricom committed Dec 9, 2024
1 parent 296327d commit fff2fca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions neat/network/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ func (l *Link) IDString() string {
func (l *Link) deriveTrait(t *neat.Trait) {
if t != nil {
l.Params = make([]float64, len(t.Params))
for i, p := range t.Params {
l.Params[i] = p
}
copy(l.Params, t.Params)
}
}
4 changes: 1 addition & 3 deletions neat/trait.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func NewTrait() *Trait {
func NewTraitCopy(t *Trait) *Trait {
nt := newTrait(len(t.Params))
nt.Id = t.Id
for i, p := range t.Params {
nt.Params[i] = p
}
copy(nt.Params, t.Params)
return nt
}

Expand Down

0 comments on commit fff2fca

Please sign in to comment.