Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Delegate class to boost performance of callbacks previously using std::function #6857

Open
wants to merge 30 commits into
base: master
from

Conversation

@dok-net
Copy link
Contributor

dok-net commented Nov 28, 2019

The Delegate class can perform calls at C-function pointer with void* argument pair efficiency, while offering the flexibility to simply use lambdas with captures and std::bind in the same places without changing the API.

void readAsync(Delegate<void,void*,int> cb)
{
    …
    cb(recvCount);
    …
}
…
readAsync([this](int received) { this->receivedAsync(received) });

or

static void receivedAsync(void* self, int received)
{
    ((SomeClass*)self)->receivedAsync(received);
}
...
readAsync({ receivedAsync, this });

The ISR handling PR #6047, Schedule.h|cpp adaptation, and WiFi etc. callbacks PR #6782 are updated and waiting to be published.

@dok-net dok-net force-pushed the dok-net:delegate branch 4 times, most recently from 5570305 to 9f14b1d Nov 28, 2019
@dok-net dok-net changed the title New Delegate class to boost performance of callbacks using std::function New Delegate class to boost performance of callbacks previously using std::function Dec 4, 2019
@dok-net dok-net force-pushed the dok-net:delegate branch from 2728d8d to 3268fb3 Dec 11, 2019
@dok-net

This comment has been minimized.

Copy link
Contributor Author

dok-net commented Dec 13, 2019

@earlephilhower It seems that you are the one taking care of CI. This build is fine except the Mac target has trouble d/l-ing the compiler suite or something at Travis. Is there any user-available way that I could retrigger failed builds without pushing changes to GitHub?

@earlephilhower

This comment has been minimized.

Copy link
Collaborator

earlephilhower commented Dec 13, 2019

@dok-net, looked like a temporary network interruption. I'm not sure if the submitter can do it, but next time you can hit the Details link, then on the RHS of the list of Travis-CI jobs there should be a small button you can use to re-run a job. If it's not there, then only the maintainers can and you'll have to wait. Don't sweat a single job failure, we can always re-fire just that job while reviewing code.

@dok-net dok-net force-pushed the dok-net:delegate branch 3 times, most recently from 6656bcc to afd76b1 Dec 14, 2019
@dok-net dok-net force-pushed the dok-net:delegate branch from e8ad8e3 to e5c3b2e Dec 22, 2019
dok-net added 18 commits Nov 28, 2019
Potential issue: automatic conversion from bind<>() doesn't work
…rgument for C-style FP is now ONLY in 3rd template argument.
…or performance.

Added documentation to the MultiDelegate class template.
…accept C-func ptr w/o

A obj argument in Delegate<..., A, P...> specializations.
@dok-net dok-net force-pushed the dok-net:delegate branch from 8185a5a to d41bd7a Dec 24, 2019
@dok-net dok-net force-pushed the dok-net:delegate branch from d41bd7a to 294ecaa Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.