MCPcopy Create free account
hub / github.com/SmingHub/Sming / evaluateSpeed

Function evaluateSpeed

samples/Basic_Delegates/app/speed.cpp:45–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void 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}

Callers 1

initFunction · 0.85

Calls 2

callbackTestFunction · 0.85
printlnMethod · 0.80

Tested by

no test coverage detected