Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

451–460 of 736 posts

Re: Was Rust Worth It?

#451
post #113

> After two decades of JavaScript and decent experience with Go, this is the most significant source of frustration and friction with Rust. It’s not an insurmountable problem, but you must always be ready to deal with the async monster when it rears its head. In other languages, async is almost invisible. I am a former C and C++ programmer who lived calling into pthread almost every week for a decade. I use async rus…

The problem that I am running into at the moment is that a few things like the rhai Engine aren't Send and I am trying to use them in an async closure. What GPT-4 suggested was creating a tokio Runtime inside the thread and then block_on(). I will try it tomorrow. (This is the first significant Rust project for me.)

You might be able to use the LocalSet (https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html) to run !Send futures on a single thread.

Re: Was Rust Worth It?

#452

Earlier quoted context omitted.

This is an unfair comparison of apples to oranges by building the binary with the wrong flags. .NET produces smaller binaries than Go with NativeAOT (despite including more features).

Yea, I missed trimming. But still NativeAOT results in 10x the size of the Go binary in Windows (win-x64)

Two aspects:

- There is no point in chasing smallest possible binary size if it trades off performance and features one wants to use in production scenario, or comes with other tradeoffs that sacrifice developer productivity. I don't see anyone complaining about the size of GraalVM native images. As long as binaries are reasonably sized, it's not an issue.

- dotnet publish -c release -p:PublishAot=true definitely produces smaller binaries than Go as of .NET 8 (and no, you cannot use the argument that it's not released yet - it's in RC.2 which is intended for evaluation for adopting .NET 8 scheduled for release next month)

Re: Was Rust Worth It?

#453

Earlier quoted context omitted.

C# is underrated by the HN crowd, I find. I quite like how mid sized firms (100-1000 employees) use it.

C# is a lovely language to work with. The only issue I have is with the .NET ... that is, building self-contained binaries to distribute. For comparison: * Hello World win-x64 binary self-contained in .NET 7 is around 70 MB * The same for Go results in 1.2 MB Edit: Missed 'trimming' in .NET, which would result in a binary of size around 11 MB in win-x64

Let me give a real world example from my own experience.

I have built a Win32 desktop app with its core logic in Go; and then re-built from scratch using .NET (v7). The core logic involved a fairly complicated keyboard input processing based on bunch of config files.

- Final binary of .NET ~ 14 MB

- Final binary of Go ~ 2 MB

Re: Was Rust Worth It?

#454

Earlier quoted context omitted.

Yea, I missed trimming. But still NativeAOT results in 10x the size of the Go binary in Windows (win-x64)

Two aspects: - There is no point in chasing smallest possible binary size if it trades off performance and features one wants to use in production scenario, or comes with other tradeoffs that sacrifice developer productivity. I don't see anyone complaining about the size of GraalVM native images. As long as binaries are reasonably sized, it's not an issue. - dotnet publish -c release -p:PublishAot=true definitely pro…

That's awesome, honestly. Can't wait.

Re: Was Rust Worth It?

#455
post #429
post #420

Earlier quoted context omitted.

To be fair, C# is ok for game dev, but not great. C# libraries are lagging heavily behind Java. Want a fastest possible library? It's in C++, and not portable to Win/Mac. So good luck with wrap + porting it. Want a decent implementation of an algo? It usually exists for Java but not for C#. Hope you like writing it from scratch. Want a C# implementation of an algo that doesn't allocate to the Nth degree. Again, write…

It is widely better recieved in the AAA gaming developer community than Java, and that is what matters. I also like Java, but c'mon no decent algorithms being implemented in C#? That is already approaching zealotry.

I didn't say no decent algorithm in C#, but for each performance sensitive algorithm/data structure there is a C and Java implementation at the least ( in my case Roaring Bitmaps).

In C# the solution is half baked or archived or abuses allocation.

I think Unity has way more with C# adoption in game dev than innate C# qualities.

Re: Was Rust Worth It?

#456

Earlier quoted context omitted.

What's a frequently encountered case for such cyclic loops? Without details I'm drawn to trying to break the cycle, either by promoting the shared state to a container object for the set, or by breaking it out into it's own object that multiple things can point at.

ASTs

You usually solve this by using a traversal helper that keeps the stack and next/prev for you without storing them inside the AST explicitly.

Re: Was Rust Worth It?

#457
post #286

Earlier quoted context omitted.

> but the ergonomic is really bad. Every time I write some rust I feel limited. > But I do not think it is a good general purpose language. Remember that this is not a sentiment that's shared by everyone. I use Rust for tasks that need anything more complicated than a shell script. Even my window manager is controlled from a Rust program. I say this as someone who has been programming in Python for nearly two decades…

> At this point, I'm about as fast in Rust as I am in Python. This is factually impossible. For anything larger than (very) small programs, Rust requires an upfront design stage, due to ownership, that it's not required when developing in GC'ed languages. This is not even considering more local complexities, like data structures with cyclical references.

That is also not shared by everyone. If you have written enough Rust to have internalized designing for the borrow checker, you don't have to spend much time in a design phase.

The only time I find I have to "fight the compiler" is when I write concurrent code, and you can sidestep a lot of issues by starting with immutable data and message passing through channels as a primitive. It's a style you have to get used to, but once you build up a mental library of patterns you can reasonably be as fast in Rust as you are in Python.

Re: Was Rust Worth It?

#458
post #336

Earlier quoted context omitted.

No you see Java devs have stockholm-syndromed themselves into believe that a giant stack of XML, or some unhinged mini-language are actually good, and much better than something the humans involved can actually read and parse easily and now to compensate with other ecosystems providing 85% of the functionality, with 5% of the pain, they’ve got to find some reason to complain about them.

what's wrong with XML? Maven XML is a configuration not a programming language.

Is this a joke? XML is horrible to work with, more boilerplate than information. Compare your average maven file to a cargo.toml and tell me which is easier to work with...

Re: Was Rust Worth It?

#459
post #344
post #2

Perhaps my biggest critique is that crates.io has no namespacing. Anyone can just claim a global and generic package name and we mostly have to deal with it (unless you avoid using the crates.io repository, but then you'll probably have more problems...). Some of these globally-claimed generic packages are not really the best package to use. Maybe it was a reaction against the Java-style reverse DNS notation, which i…

I don't see the problem. Even with namespaces you'll have brandonq/xml vs parsers/xml with no clue if one is better then another. Also possibly with some confusion over whether things with the same name are forks or not. May make it a little more difficult to Google. Why not just have brandon_xml vs xml-parser and have a community list of best and most popular libraries? I guess the only issue is that some generic/ob…

The advantage is one of trust. If the `abc` developers build well known library `abc.pqr` are well trusted then I know I can use `abc.xyz` and everything else under the same namespace without (much) vetting.

We could even have `rust.xyz` for crates that are decoupled from `std` but still maintained by rust core devs such as `regex`.

Re: Was Rust Worth It?

#460
post #428
post #425

Earlier quoted context omitted.

C# is fine, but it feels like a slightly better Java, just without the huge ecosystem of libraries.

Slightly... The difference in type erasure is pretty huge IMHO. But what libraries are you lacking?

Type reification is planned and so is value types.

And type erasure isn't as negative as you seem to make it.

Bunch of really obscure use cases - fluent localization, roaring bitmaps and so on.

Post reply on HN