Skip to content

Optimize AlgsExecutionStates

  • improve the dispatching of (the product of) two states (see https://godbolt.org/g/qWPavf for an example of the difference)
  • make AlgsExecutionStates final
  • prefer std::fill over std::vector::assign, as it (potentially) avoids a memory allocation (note the small print on assign: "All iterators, pointers and references to the elements of the container are invalidated", i.e. it may throw away the exising storage, and start from scratch. This is not the case when using std::fill, which is guaranteed to over write the existing storage.
  • add std::move where appropriate
  • reduce number of branches in Iterator
  • make iterator final
  • prefer std::all_of over std::count_if and comparing the count to the size of the container -- this allows for early termination once a state which does not satisfy the predicate is encountered.
  • only construct a MsgStream in case an error is encountered, instead of doing so unconditionally
  • make binary operators friend functions to make them symmetric wrt. (implicit) conversions of the arguments
Edited by Gerhard Raven

Merge request reports