Skip to content

Faster decoration for context-dependent functors

Rosen Matev requested to merge rmatev-functor-cache into master

!1528 (merged) improved how context-dependent functors are decorated. However, it didn't scale very well (notably because of the O(NxM) complexity: for every algorithm we try to decorate every imported functors).

This MR simplifies the logic in two ways.

  1. The functors are "wrapped" in a factory instead of a subclass. This avoids creating (many!) subclasses dynamically.
  2. The check whether we should contextualize is faster (e.g. the nonsense case of trying to contextualize a functor instance is removed).

In addition, a check is added to the functor cache cmake macro, which causes an error (with a helpful message) if not all factories were given in the cmake.

Closes Moore#187 (closed)

Related to Phys!731 (merged) and Moore!536 (merged)

Edited by Rosen Matev

Merge request reports