Chinese Whispers in Rust
thornydev.blogspot.com
Chinese Whispers in Rust
1–10 of 47 posts
Re: Chinese Whispers in Rust
#2Re: Chinese Whispers in Rust
#3Re: Chinese Whispers in Rust
#4Re: Chinese Whispers in Rust
#5http://www.reddit.com/r/rust/comments/1vnrp8/chinese_whisper...
The most salient quote from Daniel Micay (strncat):
"It doesn't demonstate a pattern you would use in Rust. Rust tasks aren't a substitute for generators/iterators and they're not around as a control flow feature."
Re: Chinese Whispers in Rust
#6See the discussion on the Rust subreddit for a more thorough discussion of the caveats in the Rust implementation: http://www.reddit.com/r/rust/comments/1vnrp8/chinese_whisper... The most salient quote from Daniel Micay (strncat): "It doesn't demonstate a pattern you would use in Rust. Rust tasks aren't a substitute for generators/iterators and they're not around as a control flow feature."
Re: Chinese Whispers in Rust
#7See the discussion on the Rust subreddit for a more thorough discussion of the caveats in the Rust implementation: http://www.reddit.com/r/rust/comments/1vnrp8/chinese_whisper... The most salient quote from Daniel Micay (strncat): "It doesn't demonstate a pattern you would use in Rust. Rust tasks aren't a substitute for generators/iterators and they're not around as a control flow feature."
Sadly it seems the "solution" there is "don't do CSP in Rust".
Re: Chinese Whispers in Rust
#8Earlier quoted context omitted.
Sadly it seems the "solution" there is "don't do CSP in Rust".
Not quite. It's "don't do retarded things using CSP in Rust".
What types of CSP things should you do in Rust, then? Which should you not? Why is this code not a demonstration of a slowness in Rust but a 'bad idea'? How would you implement it in a more idiomatic manner in Rust?
Re: Chinese Whispers in Rust
#9I profiled this and found that the vast majority of the time was spent allocating stack segments. So the basic problem is that this benchmark is simply tuned for segmented stacks. An implementation that does not use segmented stacks will do worse on this benchmark. We've rejected segmented stacks because they don't perform well in the real world (and hurt many other benchmarks, including most of the shootout), but they do make this one particular program fast.
The debate on M:N versus 1:1 threading seems irrelevant to this benchmark. In 1:1 mode we will also allocate a lot of stack space.
Channel performance is mostly irrelevant to this benchmark.
It's hard to say what the more "idiomatic" Rust version of this program would be, because this program doesn't do anything. The fastest version of this program would be println((N + 1).to_str()). :) An implementation based on libdispatch/TBB-style blocks might be faster, but it would look quite a bit different from this benchmark.
Re: Chinese Whispers in Rust
#10See the discussion on the Rust subreddit for a more thorough discussion of the caveats in the Rust implementation: http://www.reddit.com/r/rust/comments/1vnrp8/chinese_whisper... The most salient quote from Daniel Micay (strncat): "It doesn't demonstate a pattern you would use in Rust. Rust tasks aren't a substitute for generators/iterators and they're not around as a control flow feature."
Sadly it seems the "solution" there is "don't do CSP in Rust".
Calling into C is a big one: we concluded it was basically impossible to make Rust calling into C as cheap as C calling into C in a segmented stack implementation. In practical usage, we found that the ability to call into C cheaply was much more important than the benefits of small stacks, which mostly help microbenchmarks like this at the expense of real-world code.