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

is 120byte the lowest we can have? possible to lower this? #50

Open
superdolt opened this issue Sep 13, 2021 · 1 comment
Open

is 120byte the lowest we can have? possible to lower this? #50

superdolt opened this issue Sep 13, 2021 · 1 comment

Comments

@superdolt
Copy link

120byte sounds like a lot.
possible to use ideas from here to lower it?
https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

40bytes possible?

@hnes
Copy link
Owner

hnes commented Sep 13, 2021

120byte sounds like a lot.

Do you mean the size of the copied memory during coroutine switch (in the shared stack mode)?

You may refer to the source of the test_aco_benchmark.c:

// ...

void co_fp_stksz_40(){
    int ip[8];
    memset(ip, 1, sizeof(ip));
    while(1){
        aco_yield();
    }
    aco_exit();
}

void co_fp_stksz_24(){
    int ip[4];
    memset(ip, 1, sizeof(ip));
    while(1){
        aco_yield();
    }
    aco_exit();
}

void co_fp_stksz_8(){
    while(1){
        aco_yield();
    }
    aco_exit();
}

The copy size is totally determined by the actual stack size when the coroutine is doing the coroutine switch stuff. It could even be zero if you write your coroutine function elaborately enough, in assembly language for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants