| 43 | } |
| 44 | |
| 45 | void evaluateSpeed() |
| 46 | { |
| 47 | Serial.println(); |
| 48 | Serial.println(); |
| 49 | Serial << _F("Timings are in CPU cycles per loop, averaged over ") << ITERATIONS << _F(" iterations") << endl; |
| 50 | |
| 51 | int testParam = 123; |
| 52 | |
| 53 | evaluateCallback("Callback", callbackTest, testParam); |
| 54 | |
| 55 | evaluateDelegate("Delegate (function)", callbackTest, testParam); |
| 56 | |
| 57 | auto lambda = [testParam](int) { callbackTest(testParam); }; |
| 58 | evaluateDelegate("Delegate (lambda)", lambda, 0); |
| 59 | |
| 60 | TestClass cls; |
| 61 | evaluateDelegate("Delegate (method)", TestDelegate(&TestClass::callbackTest, &cls), testParam); |
| 62 | |
| 63 | evaluateDelegate("Delegate (bind)", std::bind(&TestClass::callbackTest, &cls, _1), testParam); |
| 64 | } |
no test coverage detected