Live data from Hacker News

Chinese Whispers in Rust

thornydev.blogspot.com

41–47 of 47 posts

Re: Chinese Whispers in Rust

#41
post #30

Earlier quoted context omitted.

> Rust tasks have the same large fixed-size stack as OS > threads. A fine-grained concurrency model like a task > graph would be build on top of them. In the absence of other context (I don't really know much about Rust) I would then argue that Rust tasks miss the point of CSP.

I think that's unfair. There's no absolute threshold that defines "the point of CSP"; you might equally say Go's goroutines miss the point of CSP because they're slower than the equivalent for loop. Besides, the only substantive difference between Go's implementation and Rust's implementation is that Go uses segmented stacks, while Rust does not. That is because segmented or relocating stacks are in opposition to Rus…

One might say that passing raw pointers around is against the point of CSP. As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer.

This seams more idimotic, and more CSPish to me.

(Passing around pointer/references to immutables is of course ok)

Re: Chinese Whispers in Rust

#42
post #37
post #9

Copying my message on Reddit here: I 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, incl…

Do you know if ghc uses segmented stacks ? I'm wondering, because I implemented chinese whispers in haskell and it seems to be on par with go.

Yeah, but they're recent (segmented stacks).

How stacks work in something like STG are very different from a language like Rust or C.

Re: Chinese Whispers in Rust

#43
post #41

Earlier quoted context omitted.

I think that's unfair. There's no absolute threshold that defines "the point of CSP"; you might equally say Go's goroutines miss the point of CSP because they're slower than the equivalent for loop. Besides, the only substantive difference between Go's implementation and Rust's implementation is that Go uses segmented stacks, while Rust does not. That is because segmented or relocating stacks are in opposition to Rus…

One might say that passing raw pointers around is against the point of CSP. As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer. This seams more idimotic, and more CSPish to me. (Passing around pointer/references to immutables is of course ok)

> As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer.

I may misunderstand what you're talking about, but as far as I know Go more or less passes a raw pointer (or a copy thereof) over pointer channels. It has no concept of ownership, and the pointer (and pointee) on the sender side remains valid: http://play.golang.org/p/E1bqrVFxZ6

Re: Chinese Whispers in Rust

#44
post #36

Earlier quoted context omitted.

Oh, sorry, forgot to include: 1. Only the agent that outputs a signal knows where it should be propagated[1]. (The decision of propagation is part of the each agent's internal state.) and 2. Each agent may be running on a different system than the next, and may propagate the signal using a network call instead of an internal message-pass-and-yield. Chinese Whispers is inherently a test of message passing in a distrib…

This particular benchmark is especially poor if that's what it's trying to test then, because this benchmark is completely gated on task/goroutine spawning performance and message passing barely even shows up in the profile in both Rust and Go.

Yes a "fairer" evaluation of "chinese whispers" would first setup the whole thing, then start the test and send a message into the ring.

Re: Chinese Whispers in Rust

#45
post #41

Earlier quoted context omitted.

One might say that passing raw pointers around is against the point of CSP. As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer. This seams more idimotic, and more CSPish to me. (Passing around pointer/references to immutables is of course ok)

> As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer. I may misunderstand what you're talking about, but as far as I know Go more or less passes a raw pointer (or a copy thereof) over pointer channels. It has no concept of ownership, and the pointer (and pointee) on the sender side remains valid: http://play.golang.org/p/E1bqrVFxZ6

[deleted]

Re: Chinese Whispers in Rust

#46
post #41

Earlier quoted context omitted.

I think that's unfair. There's no absolute threshold that defines "the point of CSP"; you might equally say Go's goroutines miss the point of CSP because they're slower than the equivalent for loop. Besides, the only substantive difference between Go's implementation and Rust's implementation is that Go uses segmented stacks, while Rust does not. That is because segmented or relocating stacks are in opposition to Rus…

One might say that passing raw pointers around is against the point of CSP. As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer. This seams more idimotic, and more CSPish to me. (Passing around pointer/references to immutables is of course ok)

Mixed up go and rust.

Re: Chinese Whispers in Rust

#47
post #41

Earlier quoted context omitted.

One might say that passing raw pointers around is against the point of CSP. As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer. This seams more idimotic, and more CSPish to me. (Passing around pointer/references to immutables is of course ok)

> As I understand it go does exactly what the Singularity OS does, pass over ownership instead of copy or raw pointer. I may misunderstand what you're talking about, but as far as I know Go more or less passes a raw pointer (or a copy thereof) over pointer channels. It has no concept of ownership, and the pointer (and pointee) on the sender side remains valid: http://play.golang.org/p/E1bqrVFxZ6

I mixed up go and rust. Go send around raw pointers.
Post reply on HN