Live data from Hacker News

Thoughts on Rust bloat

raphlinus.github.io

271–280 of 313 posts

Re: Thoughts on Rust bloat

#271
post #40

At the risk of being slightly tangential, I've been sorely wanting to air this particular grievance with Rust for some time. It's somewhat related, since the author mentions their package system. Its package ecosystem isn't nearly in the horrible state that node's is, but having a package system shouldn't be a substitute for designing a useful standard library for a language. I think that the attraction to 'small lan…

This, Rust std library is ridiculous compared to Golang’s one.

Re: Thoughts on Rust bloat

#272
post #6

Use polymorphism sparingly I think it is a little ironic that he speaks of performance culture but simutaneously advises to use dynamic dispatch and avoid polymorphism. I can see the justification in non-critical code paths, but serialisation is a pretty important part of most networked software nowadays so I do not think that smaller binaries and faster compilation times (better developer experience) justifies a per…

Well, I have this anecdote. We switched from serde to our own serialization / deserialization scheme (it still uses serde, but only for the JSON part), which is heavily based on dynamic dispatch, and actually got it faster.

Wasn't apples to apples comparison, but it was some times faster at the time (my memory doesn't serve me, but something around 3x to 5x). Also, compilation speed went down (well, at the time :) ). It was mostly due how some of the features work in serde (flatten and tagged enums), though.

I made a separate, cleaner, experiment (https://github.com/idubrov/dynser), which does not show that dramatic improvement (again, wasn't apples to apples, there were other factors which I don't remember), but shows some.

Re: Thoughts on Rust bloat

#273
post #207

I just don't feel like rust can replace C/C++, because the syntax is not simple enough. Rust has a lot of cool things, but to me syntax simplicity is more important. Maybe I have a hard time adapting myself to rust? Maybe my brain is too much "wired" to a C style syntax. It still seems that to me, C-style syntax is just better. I would rather prefer a C++-like language that breaks down from backward compatibility wit…

Maybe you're looking for D? :) Anyway, what is "not simple" about Rust's syntax?

Using "let thing: type" seems bloated, I prefer the C style "type thing;"

; can also make a lot of difference, which is a little weird.

I don't understand why there is both str and String, seems complicated for nothing.

Option things are not really clear yet, and I don't understand what is their use, it seems like an alternative to unions, but few developers use unions anyway...

Pattern matching seems powerful but I fail to understand its usage, and I'm a little skeptical about the machine code it generates.

D is fine, but I think that even D is not simple enough.

Rust seems like it's awesome, but it requires to entirely rethink how you write code, and I've never been a fan of high level abstraction.

Re: Thoughts on Rust bloat

#274
post #207

I just don't feel like rust can replace C/C++, because the syntax is not simple enough. Rust has a lot of cool things, but to me syntax simplicity is more important. Maybe I have a hard time adapting myself to rust? Maybe my brain is too much "wired" to a C style syntax. It still seems that to me, C-style syntax is just better. I would rather prefer a C++-like language that breaks down from backward compatibility wit…

C++ has simple syntax? Since when?

Since you're not really required to use templates or inheritance at every corner.

Re: Thoughts on Rust bloat

#275

Earlier quoted context omitted.

Ok thanks. Is the intention for that to grow, as a curated set of libraries that isn't quite the standard library? Or so you think some of those will move into the standard library if they become canonical or stable enough?

We’ll see; it’s not a simple thing. In theory they can move into the standard library, but none ever have. The process exists though.

I can think of a bunch of stuff that has moved or is moving from third party crates into the standard library: parking_lot, hashbrown, (minimal) Future trait. But I agree that no crate has moved wholesale into the standard lib.

Re: Thoughts on Rust bloat

#276
post #257

Earlier quoted context omitted.

It does depend on this yes, but the random seed isn’t part of the public API. An RNG API in std would need to pick an algorithm and make that part of its stability guarantees.

In this case I'd quibble that it wouldn't need to guarantee a specific algorithm, just a minimal set of properties. If the user can't manually set the seed then they'll be no expectation that it's deterministic or follows any particular algorithm. So the precise implementation can change with versions or even platforms. Javascript's Math.random and Crypto.getRandomValues works this way.

Id say that in Rust’s case, we’ve already seen several painful examples of Hyrum’s law.

http://www.hyrumslaw.com/

Re: Thoughts on Rust bloat

#277

Earlier quoted context omitted.

It doesn't have to be the absolute fastest, it just has to work. What is far better and faster than SHA3? And while SHA2 wasn't designed for that use, it's easy to make simple and provably correct constructs that turn a secure hash into a secure RNG.

You’re speculating to prove a point. I would definitely not want my std to be designed this way.

1. It was just an example.

2. You definitely don't want your std to be designed with a simple API to a fast, secure, and popular crypto primitive? Pretend I named your favorite one, to avoid bikeshedding issues.

Re: Thoughts on Rust bloat

#278

Earlier quoted context omitted.

It doesn't have to be the absolute fastest, it just has to work. What is far better and faster than SHA3? And while SHA2 wasn't designed for that use, it's easy to make simple and provably correct constructs that turn a secure hash into a secure RNG.

ChaCha20 is widely used for CSRNG.

Agreed, that would work fine. But for a generic RNG function, I feel like the difference between 3 and 7 cycles per byte isn't too impactful.

Re: Thoughts on Rust bloat

#279
post #31

Earlier quoted context omitted.

Even Raspberry Pis have many GBs of both disk and RAM and super fast USB, MicroSD, and network transfer speeds. I don't really see the difference between 5mb and 20mb bins. And I'm a fan of minimalist OS systems like Archlinux with a slim set of running services. Disk space isn't really the main concern besides as a symbolic measure of cruft. No system is ever going to fill up space by having too many OS/terminal pro…

>> Even Raspberry Pis have many GBs of both disk and RAM and super fast USB, MicroSD, and network transfer speeds. You are speaking about _latest_ Pis.

No I'm not. Pi 2 meets all of those requirements and has MicroSDHC which offer tons of high speed space even at entry level.

Besides that was an example, I have plenty of other IoT and embedded style hardware and they are all fitting this criteria.

Simply put the size of binaries has never been a real concern for some time now and the few rare cases where it might matter probably aren't worth all the effort made obsessing over sub 50mb bin size.

99%+ of it will be people who "feel" like it should be small, without any good reason.

Re: Thoughts on Rust bloat

#280
post #84

Earlier quoted context omitted.

Arguing about 10KB or 100KB applications on a comment page that's 40kb in size is somewhat silly. It's _worth_ it to trade 1mb, 10mb or 100mb of app size in some cases. That's why you don't hand-craft your "simple 100kb guis" in assembly and have them only be 1kb. Exactly the same principle applies here. Plus, realistically, users don't care. Not one bit. That's why Slack is out here capturing the market, while some…

> Plus, realistically, users don't care. Not one bit. I disagree. I develop an audio workstation - https://ossia.io ; the total size is between 50 and 100 megabytes depending on the platforms. It uses Qt and LLVM and is itself around 500kloc so I'm already around the lower limits of what I can do. My users, & much people on the internet keep comparing it in size to Reaper, another DAW where the binary is around 10 me…

You might find this article interesting:

http://blog.johnnovak.net/2016/05/29/cross-platform-gui-trai...

Post reply on HN