Philogy / balls

A DSL for generating optimal EVM bytecode
MIT License
184 stars 7 forks source link

Speed up scheduler #10

Open Philogy opened 4 months ago

Philogy commented 4 months ago

Having a quite large search space the optimal Dijkstra scheduler is quite slow, essentially investigating the best options breadth-first until a solution is found.

Implementation wise there's still some low-hanging fruit that could improve performance mainly:

The biggest performance improvements will come from designing a better heuristic for the A scheduler. Thanks to the properties of A, as long as the heuristic is admissible (i.e. never over-estimates the remaining distance) the final result is still guaranteed to be optimal unlike the current default heuristic "Guessoor", which delivers decent results but doesn't have the best guarantees.

A better heuristic may require a slight modification of the scheduler to allow for non-whole number cost values.

Once a better algorithm is found the compiler can be extended to speed up scheduling even further (at the cost of the solution's optimality) via bounded relaxation.