hnes/libaco

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

Opened this issue · 1 comments

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 commented

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.