Chaining Function

struct Context {
  // complex class
};

void Step1(Context &ctx) {
  // complex function
}

void Step2(Context &ctx) {
  // complex function
}

for (auto &context : contexts) {
  Step1(context);
  Step2(context);
  Step1(context);
  Step2(context);
}
for (auto &context : contexts) {
  Step1(context);
}
for (auto &context : contexts) {
  Step2(context);
}
for (auto &context : contexts) {
  Step1(context);
}
for (auto &context : contexts) {
  Step2(context);
}

* The benchmark is run under AMD Ryzen 9.

* For the full benchmark code, please refer here.