Thread safety for status updates, periodically minify
This commit is contained in:
@@ -8,8 +8,14 @@ import "github.com/firestuff/subcoding/vm"
|
||||
const instructionsPerFunctionMean = 15
|
||||
const instrucitonsPerFunctionStdDev = 10
|
||||
|
||||
func Mutate(prog *vm.Program) {
|
||||
target := int(rand.NormFloat64()*instrucitonsPerFunctionStdDev+instructionsPerFunctionMean)
|
||||
const minifyPeriodMean = 10000
|
||||
|
||||
func Mutate(def *Definition, prog *vm.Program) {
|
||||
if rand.Intn(minifyPeriodMean) == 0 {
|
||||
def.minifyProgram(prog) // ignore error
|
||||
}
|
||||
|
||||
target := int(rand.NormFloat64()*instrucitonsPerFunctionStdDev + instructionsPerFunctionMean)
|
||||
|
||||
if len(prog.Functions[0].Instructions) < target {
|
||||
addInstruction(prog, prog.Functions[0])
|
||||
|
||||
Reference in New Issue
Block a user