Blender V4.3
FN_multi_function_procedure_optimization.hh File Reference

Go to the source code of this file.

Namespaces

namespace  blender
 
namespace  blender::fn
 
namespace  blender::fn::multi_function
 
namespace  blender::fn::multi_function::procedure_optimization
 

Functions

void blender::fn::multi_function::procedure_optimization::move_destructs_up (Procedure &procedure, Instruction &block_end_instr)
 

Detailed Description

A #Procedure optimization pass takes an existing procedure and changes it in a way that improves its performance when executed.

Oftentimes it would also be possible to implement a specific optimization directly during construction of the initial #Procedure. There is a trade-off between doing that or just building a "simple" procedure and then optimizing it uses separate optimization passes.

  • Doing optimizations directly during construction is typically faster than doing it as a separate pass. However, it would be much harder to turn the optimization off when it is not necessary, making the construction potentially slower in those cases.
  • Doing optimizations directly would also make code more complex, because it mixes the logic that generates the procedure from some other data with optimization decisions.
  • Having a separate pass allows us to use it in different places when necessary.
  • Having a separate pass allows us to enable and disable it easily to better understand its impact on performance.

Definition in file FN_multi_function_procedure_optimization.hh.