Live data from Hacker News

Considering Rust [video]

youtube.com

41–46 of 46 posts

Re: Considering Rust [video]

#41
post #27

Earlier quoted context omitted.

Because performance is a P0 concern to a lot of people. Rust (and C++) has performance as a primary goal, Scala does not.

Did you even watch the video? The guy is comparing rust to things like Python which is a pretty silly comparison, relative to scala.

Everybody knows python, few people know Scala. Isn't that enough of a reason?

Re: Considering Rust [video]

#42
post #40

Rust is interesting, so I decided to include it in a 3 language prototyping project. I wanted to experience how it is to code for these languages, compared to the outcome. The project was dead simple, read 2 files concurrently and match lines by id's. Data was a bit unstructured, some lines would go unmatched, some would be duplicates, and report on that while deallocating memory for processing large filesizes. Ruby:…

For me, Rust also fits "fun language to quickly prototype type system in", but I've been hacking in Rust since its 0.* days; if I were to try to do it in Ruby/Go which I've barely ever touched, it would sure take me way much longer.

If I were to compare Rust to Python/C++ which I'm proficient in, Python would be the fastest because there's zero setup time, tons of quality packages and notebook environment; C++ would take a lot longer due to having to set up builds, and due to lacking stdlib and ecosystem.

Re: Considering Rust [video]

#43
post #7

I'm 20 minutes in and he's spending a lot of time talking about how Rust gets correctness right. Are there any anecdotal stories about how Rust programs have fewer errors? Facebook, for example, rewrote Messenger with ReasonML: https://reasonml.github.io/blog/2017/09/08/messenger-50-reas... And it had a lot fewer bugs: "Messenger used to receive bugs reports on a daily basis; since the introduction of Reason, there h…

anecdote incoming!

In my previous gig, we had a premium website hosting platform, and our incoming clients would usually want their old inbound links to keep working. Over time, this meant a few hundred thousand autogenerated rewrite rules in Nginx. This was causing Nginx to use about 10G of memory, so restarting it, which we had to do every time we added a redirect, was an issue.

I replaced this with a small reverse proxy written in rust that loaded all of the redirects from postgresql into a cuckoo filter. Adding a redirect was an INSERT, followed by a NOTIFY to let the proxy know to add the redirect to the filter.

Putting it all together took about 2 weeks of swearing at the compiler, but it never had an issue in production, and used about 1M of memory, while adding less than 1ms of latency, or about 4ms in case of a filter hit. Cuckoo filters can have false positives, so if a redirect was found, we still had to check in the db table before returning 301.

As far as I know it's still working fine, and I use rust whenever I can.

Re: Considering Rust [video]

#44
post #7

I'm 20 minutes in and he's spending a lot of time talking about how Rust gets correctness right. Are there any anecdotal stories about how Rust programs have fewer errors? Facebook, for example, rewrote Messenger with ReasonML: https://reasonml.github.io/blog/2017/09/08/messenger-50-reas... And it had a lot fewer bugs: "Messenger used to receive bugs reports on a daily basis; since the introduction of Reason, there h…

anecdote incoming! In my previous gig, we had a premium website hosting platform, and our incoming clients would usually want their old inbound links to keep working. Over time, this meant a few hundred thousand autogenerated rewrite rules in Nginx. This was causing Nginx to use about 10G of memory, so restarting it, which we had to do every time we added a redirect, was an issue. I replaced this with a small reverse…

Interesting! Any chance you can share a few tips to get started doing the same? (eg any crates to use or other tips). I'm currently looking for a rust learning project and building what you described really hits the mark!

Re: Considering Rust [video]

#45
post #36

I've just "incompleted" my first Rust project: a Minecraft server. I gave up due to the protocol, not Rust. I finally learned the damn thing after spouting its hypothetical advantages all over the internet. My overall conclusion was correct, but the reasoning incorrect. The borrow checker is an amazing pair programmer, but that's not the primary reason I'm having genuine fun. Rust is a systems language that is a plea…

> Please, for the sanity of the rest of us, stop using C build systems. They are just unbelievably terrible

That's not an argument. You do not even try to explain why it is terrible.

C build systems are terrible because they handle 30 years of legacy, 10 different compilers and 100 of platforms that all have their specific non-sense to handle at different compilation stages.

You can also add on that the non-standard build system specific way to handle things like debug/release builds or dynamic/static linking because every system created its own for fun... ( --release/CMAKE_BUILD_TYPE=Release/make release/-Q release=1/etc/etc, .lib files/so/a/dylib/rpath/dt_runpath, lto/not-lto, -Wl,-Bdynamic/-BStatic, etc, etc, etc )

And you get the mess you are in.

The real question on that is: Will Rust be any better in 20 years ?

My hope is that the community will be smart enough to not fragment. But history told us that every OSS project big enough fragment soon or later.

Re: Considering Rust [video]

#46
post #15

Can somebody please explain why Rust has so much buzz right now compared to scala? Scala is a strongly typed, very-well vetted, functional programming language in the JVM. It pretty much has everything going for it. It's even adopted by twitter.

JVM, garbage collected, doesn't have zero overhead abstractions. Might as well ask why Scala didn't take over from C++.

I don't use Rust. But I never considered Scala because of the JVM.
Post reply on HN