Minify only at new best program time
This commit is contained in:
@@ -57,6 +57,15 @@ func (def *Definition) Grow(statusChan chan<- Status) (*vm.Program, error) {
|
||||
}
|
||||
|
||||
if score > status.BestScore {
|
||||
err = def.minifyProgram(prog)
|
||||
if err != nil {
|
||||
if statusChan != nil {
|
||||
close(statusChan)
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
status.BestScore = score
|
||||
status.BestProgram = prog.Copy()
|
||||
|
||||
@@ -65,20 +74,6 @@ func (def *Definition) Grow(statusChan chan<- Status) (*vm.Program, error) {
|
||||
}
|
||||
|
||||
if status.BestScore == status.TargetScore {
|
||||
err = def.minifyProgram(prog)
|
||||
if err != nil {
|
||||
if statusChan != nil {
|
||||
close(statusChan)
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
status.BestProgram = prog.Copy()
|
||||
|
||||
if statusChan != nil {
|
||||
statusChan <- status
|
||||
}
|
||||
|
||||
if statusChan != nil {
|
||||
close(statusChan)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user