Live data from Hacker News

Rust can be difficult to learn and frustrating, but it's also very exciting

influxdata.com

261–270 of 282 posts

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#261
post #244

Earlier quoted context omitted.

> JVM based languages; they can have very poor startup times (compared to c++) [2] Hello world :-) And is 54.55 ms perceptable? (310.81 ms should be).

> And is 54.55 ms perceptable? Its probably noticeable compared to instantaneously in terms of "feeling" different due to lag. However, it is definitely perceptible in the terminal based on my testing using `sleep`. For me (on my computer + monitor) down to 25ms is noticeable. Also importantly, the hello world test shows 2 orders of magnitude simply, but the problem for JVM based languages gets worse for large projec…

> Real java projects …

Can take much longer, and are engineered so that users don't experience a delay.

The users interact with a system that is already launched and up-to-speed. So much for Hello world!

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#262
post #245

Earlier quoted context omitted.

> That benchmarks game quote supports my point… As-long-as your point was not intended to be dismissive in any way. > prohibited optimizations Go programs are not prohibited from using arena allocation provided by a generally available library — that is what the C++ programs do. Unfortunately there doesn't seem to be a generally available Go library that provides arena allocation. Of course, Go does provide GC.

It is dismissive of the idea that the game can tell you meaningful things about a programming language’s average or percentile performance or even its peak performance. > Go programs are not prohibited... Right, and this is why the Go benchmarks for allocations aren’t very meaningful. Using arenas (or other kinds of preallocation) is a common optimization in Go even if Go doesn’t have a library for it. I’m sure you’r…

Where did you get the idea that 10 tiny tiny programs could tell you about a programming language’s average performance?

Who in this discussion has made any such a claim?

You repeatedly put up a straw man.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#263
post #242

Earlier quoted context omitted.

Haven't spent that much time with rust, but so far Result has sufficed for all my exception-needs; it's not clear to me what the practical difference is between exceptions and result , that would be relevant to implementing real software systems? As I understand it, the primary usage of both is to report, and handle, errors. Rust splits it as panic! and Result , where panic! is naturally left for logic errors (ie sta…

> I'm not sure how often you want to recover from such a state though. Pretty much always in real systems software. Imagine a multithreaded server that handles HTTP requests. A catastrophic invariant failure when handling one requests shouldn't bring down the whole server. Or imagine an application that calls into a money transaction routine. (This routine can itself call other routines, and so on for 12 stack frames…

When I'm talking about invariants, I mean something much more fundamental than a web-request failing. It's not a necessarily invalid state (and I'm not sure ever should be for any well-behaved program). It would be invalid if you've explicitly decided not to handle the scenario, but at least in Rust (and assuming the function properly returns Result), you can't forget to not handle it.

Essentially where you'd have asserts() in C. eg Your in-place sort function is meant to maintain a sorted list for all elements traversed so far: you add a panic check to guarantee this. It fails; the invariant is broken, and there's no recovering from such a state (your sort is not sorting! you're going to add a handler for this..?).

A web-request failing is a simple, normal, expected failure (hence the Result type). Adding 1+1 and getting 3 is a broken invariant, and there's no coming back from it. Again, you can (probably) catch it in Java since it throws exceptions on anything and everything... but why would you want to? If you take its to its conclusion, you're not trusting any aspect of the language anymore: you'll have to check every bit of code for arbitrary outcomes.

It seems to me similar to javascript allowing you to basically pass in anything to everything and get ...some... output, but its an extremely bug-prone methodology.

panic! is, afaik, intended for those situations where it should bring down the whole application (before you start adding $3 to person A, but subtracting $2 from person B); primarily to catch programmer errors, not execution errors. Errors that can be recovered from are Result, and the Result type forces you to handle all possible outcomes (which the caller might decide is a panic!). A failed web-request is most certainly a Result in this model, not a panic!.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#264

Earlier quoted context omitted.

Also complexity - managing an order of magnitude more instances is more hassle.

The OP only doubled their performance by rewriting in Rust though...

And depending on the amount of code, that's an awesome trade-off if OP can just have one instance instead of managing a cluster.

From what OP has said, there's probably a good change they can get more performance with some optimization.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#265
post #261

Earlier quoted context omitted.

> And is 54.55 ms perceptable? Its probably noticeable compared to instantaneously in terms of "feeling" different due to lag. However, it is definitely perceptible in the terminal based on my testing using `sleep`. For me (on my computer + monitor) down to 25ms is noticeable. Also importantly, the hello world test shows 2 orders of magnitude simply, but the problem for JVM based languages gets worse for large projec…

> Real java projects … Can take much longer, and are engineered so that users don't experience a delay. The users interact with a system that is already launched and up-to-speed. So much for Hello world!

I was just trying to come up with a real situation where there is a 2 order of magnitude difference.

Obviously in many situations you can mitigate the startup time. However, it does lock Java out of being a good replacement for git or other quick command line tools.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#266
post #260

Earlier quoted context omitted.

> And is 54.55 ms perceptable? Its probably noticeable compared to instantaneously in terms of "feeling" different due to lag. However, it is definitely perceptible in the terminal based on my testing using `sleep`. For me (on my computer + monitor) down to 25ms is noticeable. Also importantly, the hello world test shows 2 orders of magnitude simply, but the problem for JVM based languages gets worse for large projec…

"The basic advice regarding response times has been about the same for thirty years : 0.1 second is about the limit for having the user feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result." https://www.nngroup.com/articles/response-times-3-important-...

Originally you asked "is 54.55 ms perceptable?", I say yes. I can tell the difference between 25 ms and 1 ms in my terminal.

That said, I don't think it is worth trying to reduce your startup time to the point where you can't tell the computer took time. Getting "the user [to] feel that the system is reacting instantaneously" is a different and more important goal.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#267
post #251

Earlier quoted context omitted.

Thanks for the thoughtful post. I do have a question, that maybe you can answer? > The languages are all turing-compatible anyway, so it's not about what can be done, it's about what approaches does the language make easy and promote. Turing completeness is kinda besides the point. We probably wouldn't be talking about it on HN if it wasn't. :) I guess what I'm wondering is does Rust encourage simpler but possibly sl…

As with all performance questions, the answer is “it depends.” For a look into this question, see http://dtrace.org/blogs/bmc/2018/09/28/the-relative-performa...

Hey thanks for the response.

I'm happy that rust has a good set of performant data structures, but on the other I feel like it's too soon to say Rust is the big winner here as the author does. I've been very skeptical on fantastical claims by language promoters.

But taking the pain out of making common data structures is a good start.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#268

Earlier quoted context omitted.

The OP only doubled their performance by rewriting in Rust though...

And depending on the amount of code, that's an awesome trade-off if OP can just have one instance instead of managing a cluster. From what OP has said, there's probably a good change they can get more performance with some optimization.

You still need redundancy, so you’re operating multiple instances either way (or you’re playing fast and loose).

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#269
post #262

Earlier quoted context omitted.

It is dismissive of the idea that the game can tell you meaningful things about a programming language’s average or percentile performance or even its peak performance. > Go programs are not prohibited... Right, and this is why the Go benchmarks for allocations aren’t very meaningful. Using arenas (or other kinds of preallocation) is a common optimization in Go even if Go doesn’t have a library for it. I’m sure you’r…

Where did you get the idea that 10 tiny tiny programs could tell you about a programming language’s average performance? Who in this discussion has made any such a claim? You repeatedly put up a straw man.

Im not sure why you’re confused. ilovecaching made claims about the relative performance of programming languages based on the benchmark game.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#270
post #148
post #73

Earlier quoted context omitted.

> I'm very bullish on Rust becoming the language of choice in the 2020s for everything from operating systems, web services, desktop applications, and more. It's that good. I don't mean to burst your bubble here. But people need to feel productive quickly with a language, otherwise they'll drop it and move to something else which makes them feel that way. Looking at this thread there are plenty of examples of "I love…

Comparing Haskell to JavaScript is silly - JavaScript is popular because it is the only option in the browser. It has noting to do with the quality of the language itself. If VBScript had won, everyone would be using that. If Netscape had decided to use Scheme or Haskell as the scripting language, this is what everyone would be using. Rust is competing in the space of C and C++, it is not competing against Java or Py…

If Netscape had used Haskell the WWW might never has taken off. Or att least scripting it might not.
Post reply on HN