These are chat archives for rust-lang/rust

Dec 2017
Michal 'vorner' Vaner
Dec 23 2017 07:34
@alkis That would need a lot of very special circumstances to be measurable at all. Most of today code's runtime is dominated by things like waiting for memory to produce data, not how exactly you call your functions. I don't have numbers, but my gut feeling is that the difference wouldn't even show in practice (and I don't talk about IO only).
Mert Gör
Dec 23 2017 11:40
Hi People any Community Team member here ? I have mailed to you dear members
Michal 'vorner' Vaner
Dec 23 2017 14:06
I'm daydreaming about writing a little game. And I have two questions.
  • I know about ggez. But I was wondering, is there a framework that also works on android or web (wasm)? I found issues to eventually support these in ggez, so maybe it's the best option, but it's not there yet.
  • I'm looking at std::sync::Arc. Does anyone know if it's possible to atomically swap two arcs? Not their content, just the pointers, something like AtomicUsize, but with a pointer.
Andrey Lesnikov
Dec 23 2017 14:08
(btw, FYI there's room)
I don't think that an out-of-the-box android+wasm pure rust solution exists yet. ggez is based on SDL2 so it should work at these platforms, but I think it'll require some serious efferots.
Andrey Lesnikov
Dec 23 2017 14:13
glutin supports android to some degree and recent versions should even support wasm, but I'm not 100% sure about the latter.
Alkis Evlogimenos
Dec 23 2017 15:55
@vorner agree that a memory stall is very expensive. Doing two loads instead of one is going to make stalling on memory more often. In the end it depends how good is the branch predictor in predicting where we are jumping next (what's the next state) vs cost of indirect function call. Anyway... that's not even a big issue with the state of rust coros/async. The problem is that the API does not compose. Also some things you can't even do. kotlin seems to have done something decent with their coroutines - it composes very well and they didn't really add much in the language at all. Still I think it can be done better and there is a lot of innovation room in this space (noone has done it well just yet)