More Windows performance tweaks
This commit is contained in:
parent
391ec2ae9e
commit
e1b6f2937b
3 changed files with 23 additions and 16 deletions
2
pool.lua
2
pool.lua
|
@ -6,7 +6,7 @@ local serpent = dofile(base.."/serpent.lua")
|
||||||
local libDeflate = dofile(base.."/LibDeflate.lua")
|
local libDeflate = dofile(base.."/LibDeflate.lua")
|
||||||
|
|
||||||
local hasThreads =
|
local hasThreads =
|
||||||
--not util.isWin and
|
not util.isWin and
|
||||||
config.NeatConfig.Threads > 1
|
config.NeatConfig.Threads > 1
|
||||||
local Runner = nil
|
local Runner = nil
|
||||||
if hasThreads then
|
if hasThreads then
|
||||||
|
|
|
@ -76,7 +76,10 @@ runner.onLoad(function(filename)
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local waiter = util.startWaiting(inputFilePath)
|
local waiter = nil
|
||||||
|
if not isWin then
|
||||||
|
waiter = util.startWaiting(inputFilePath)
|
||||||
|
end
|
||||||
|
|
||||||
local function waitLoop()
|
local function waitLoop()
|
||||||
if not first then
|
if not first then
|
||||||
|
@ -95,7 +98,9 @@ local function waitLoop()
|
||||||
|
|
||||||
print('Waiting for input from master process')
|
print('Waiting for input from master process')
|
||||||
|
|
||||||
|
if not isWin then
|
||||||
util.finishWaiting(waiter)
|
util.finishWaiting(waiter)
|
||||||
|
end
|
||||||
|
|
||||||
local inputData = nil
|
local inputData = nil
|
||||||
local ok = false
|
local ok = false
|
||||||
|
@ -149,7 +154,9 @@ local function waitLoop()
|
||||||
local inputFile = io.open(inputFilePath, "w")
|
local inputFile = io.open(inputFilePath, "w")
|
||||||
inputFile:close()
|
inputFile:close()
|
||||||
|
|
||||||
|
if not isWin then
|
||||||
waiter = util.startWaiting(inputFilePath)
|
waiter = util.startWaiting(inputFilePath)
|
||||||
|
end
|
||||||
|
|
||||||
-- Write the result
|
-- Write the result
|
||||||
local outFile = io.open(outputFilePath, "w")
|
local outFile = io.open(outputFilePath, "w")
|
||||||
|
|
|
@ -67,8 +67,18 @@ return function()
|
||||||
onSaveHandler = {},
|
onSaveHandler = {},
|
||||||
onLoadHandler = {},
|
onLoadHandler = {},
|
||||||
poppets = {},
|
poppets = {},
|
||||||
|
hostProcess = "lsnes",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if util.isWin then
|
||||||
|
_M.hostProcess = util.scrapeCmd('*l', 'powershell "(Get-WmiObject Win32_Process -Filter ProcessId=$((Get-WmiObject Win32_Process -Filter ProcessId=$((Get-WmiObject Win32_Process -Filter ProcessId=$PID).ParentProcessId)).ParentProcessId)").ExecutablePath')
|
||||||
|
if _M.hostProcess == nil or _M.hostProcess == "" then
|
||||||
|
_M.hostProcess = "lsnes-bsnes.exe"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- FIXME Linux
|
||||||
|
end
|
||||||
|
|
||||||
_M.onRenderForm = function(handler)
|
_M.onRenderForm = function(handler)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,16 +99,6 @@ return function()
|
||||||
end
|
end
|
||||||
|
|
||||||
_M.run = function(species, generationIdx, genomeCallback, finishCallback)
|
_M.run = function(species, generationIdx, genomeCallback, finishCallback)
|
||||||
local hostProcess = "lsnes"
|
|
||||||
if util.isWin then
|
|
||||||
hostProcess = util.scrapeCmd('*l', 'powershell "(Get-WmiObject Win32_Process -Filter ProcessId=$((Get-WmiObject Win32_Process -Filter ProcessId=$((Get-WmiObject Win32_Process -Filter ProcessId=$PID).ParentProcessId)).ParentProcessId)").ExecutablePath')
|
|
||||||
if hostProcess == nil or hostProcess == "" then
|
|
||||||
hostProcess = "lsnes-bsnes.exe"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- FIXME Linux
|
|
||||||
end
|
|
||||||
|
|
||||||
local inputPrefix = tmpFileName..'_input_'
|
local inputPrefix = tmpFileName..'_input_'
|
||||||
local outputPrefix = tmpFileName..'_output_'
|
local outputPrefix = tmpFileName..'_output_'
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ return function()
|
||||||
local outputFileName = outputPrefix..i
|
local outputFileName = outputPrefix..i
|
||||||
local inputFileName = inputPrefix..i
|
local inputFileName = inputPrefix..i
|
||||||
|
|
||||||
message(_M, hostProcess)
|
message(_M, _M.hostProcess)
|
||||||
|
|
||||||
local settingsDir = nil
|
local settingsDir = nil
|
||||||
if isWin then
|
if isWin then
|
||||||
|
@ -134,7 +134,7 @@ return function()
|
||||||
|
|
||||||
local waiter = util.startWaiting(outputFileName)
|
local waiter = util.startWaiting(outputFileName)
|
||||||
|
|
||||||
local cmd = '"'..hostProcess..'" "--rom='..config.ROM..'" --unpause "--lua='..base..'/runner-process.lua"'
|
local cmd = '"'.._M.hostProcess..'" "--rom='..config.ROM..'" --unpause "--lua='..base..'/runner-process.lua"'
|
||||||
local poppet = util.popenCmd(cmd, nil, envs)
|
local poppet = util.popenCmd(cmd, nil, envs)
|
||||||
table.insert(_M.poppets, poppet)
|
table.insert(_M.poppets, poppet)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue