rusty-io/asio
People
Repo info
Activity
Leonard Hecker
@lhecker
you know what?
having "CLS" would actually be cool
you're right
it would solve dumb shit like that
but how do you make access to it fast?
if you allocate a CLS slab for every coroutine you defeat the purpose of allocating stuff on the stack of the coroutine in the first place...
I feel like we shouldn't solve the issue of TLS
if we did that we would severely hinder performance
instead we should work on making all libraries which make use of TLS coroutine compatible
for instance by removing TLS from libpanic
Y. T. CHUNG
@zonyitoo
btw, if someone call a IO operation within the
with()
method
then triggers a coro switch
Leonard Hecker
@lhecker
yeah that would be unsafe I know
Y. T. CHUNG
@zonyitoo
what would happen ...
coroutine local storage is required for some usecase, i think it is fine
we can, for example, cache that CLS table after coroutine is destroied
so we won't need to allocate that table everytime
many optimization methods could be adopted in here
Leonard Hecker
@lhecker
hmm...
my first thought was:
keep a max() of the size of all previous CLS tables
whenever we create a coroutine we allocate that size for the CLS table on the stack
and if a new entry is added outside of that table we create a dynamically sized copy
or:
we figure out how to register all CLS macros before even main() is called
in C++ you can do that using static constructors
in C and LLVM you can write:
__attribute__((constructor))
void
initializer
()
{ ... }
if we can do the same in Rust we could indeed build fast CLS access
Y. T. CHUNG
@zonyitoo
actually... we can do whatever we want before fn main() ...
because we are modifying libstd
Leonard Hecker
@lhecker
kinda...
you have to still actually FIND all CLS macros ;)
and how do you do that without those constructors?
Y. T. CHUNG
@zonyitoo
hmm, well, indeed ...
that's a problem
Y. T. CHUNG
@zonyitoo
@lhecker
I have already pushed a kqueue echo server impl
Leonard Hecker
@lhecker
Did you stop working on this for today?
Y. T. CHUNG
@zonyitoo
i would continue examine how to convert it to a Proactor model
but won't push unless i have any significant changes
Leonard Hecker
@lhecker
Please still push whatever you have before going offline - this will ensure that we can work interleaved on this 🙂
BTW: alexcrichton's futures library seems to be interesting
Y. T. CHUNG
@zonyitoo
hmm, i stop working now
hmm? give me a link
Leonard Hecker
@lhecker
Here:
https://github.com/alexcrichton/futures-rs
i feel like its a lot harder to understand than my futures code though
I've read it for 10-15min and didnt get it
Y. T. CHUNG
@zonyitoo
lol
Leonard Hecker
@lhecker
For instance I dont know what this tailcall() stuff is
or why he uses that scheduler() method
_