Live data from Hacker News

Thoughts on Rust, a few thousand lines in

rcoh.me

181–183 of 183 posts

Re: Thoughts on Rust, a few thousand lines in

#181

Earlier quoted context omitted.

We could have never implemented Index for String, sure. We have though, so removing it would be a breaking change.

Ok (Maybe a compile time warning? that doesn't break the build)

That could be done, if it was agreed that this is a mis-feature. I don't think there's agreement on that, though.

Re: Thoughts on Rust, a few thousand lines in

#182
post #174

Earlier quoted context omitted.

Goroutine are very different from thread in practice. you don’t have to pay the memory usage and context switch cost you would have if using large amounts of threads. It’s also faster to do IO processing from a single thread in batch instead of having one OS thread per request.

Context switches on I/O are the same for 1:1 and M:N because you're eating the cost of a kernel to user context switch either way. Memory usage per thread is a property of the GC, not M:N threading. You can have very small stacks in a 1:1 implementation too.

there is less context switches because you cant write some data to several distinct file descriptor using a single system call.

You can also read data from several file descriptor in a single System Call.

This way you significantly reduce the number of System call instead of doing one blocking read() per connection. I believe context switch round trip (from user space to kernel to user space) is much more expensive than simply switching between goroutine of the same process.

Re: Thoughts on Rust, a few thousand lines in

#183

I've not done any rust dev before but the whole variable shadowing thing really scares me, in that it makes it not obvious where the initial declaration comes from. This seems difficult to reason about.

IMO, it should scare you less than mutating the variable, which is the equivalent pattern in most other languages.

[deleted]
Post reply on HN