mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[yul-phaser] Store already loaded program in Population and make copies when computing fitness
- Until now the source code was being parsed during every fitness computation. Now the parsed program is reused and only the optimisation steps are applied each time.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <tools/yulPhaser/Exceptions.h>
|
||||
#include <tools/yulPhaser/Population.h>
|
||||
#include <tools/yulPhaser/Program.h>
|
||||
|
||||
#include <libsolutil/Assertions.h>
|
||||
#include <libsolutil/CommonIO.h>
|
||||
@@ -54,7 +55,8 @@ CharStream loadSource(string const& _sourcePath)
|
||||
|
||||
void runAlgorithm(string const& _sourcePath)
|
||||
{
|
||||
auto population = Population::makeRandom(loadSource(_sourcePath), 10);
|
||||
CharStream sourceCode = loadSource(_sourcePath);
|
||||
auto population = Population::makeRandom(Program::load(sourceCode), 10);
|
||||
population.run(nullopt, cout);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user