Live data from Hacker News

Recent adventures in performance optimization with Rust

willcrichton.net

71–75 of 75 posts

Re: Recent adventures in performance optimization with Rust

#71
post #28

Earlier quoted context omitted.

you're getting downvoted because you said it in a weird way, but fundamentally I have to agree. Both C and C++, if written idiomatically, have less syntactic sugar and macros are less accepted, so that their code ends up hiding a lot less complexity than rust code. Fairly complex code like what the author showed turns out to use a bunch of different random things nobody expected.

> code ends up hiding a lot less complexity than rust code Are you really saying this about C++? For real? I quite like C++ but the idea that it doesn't hide complexity is hilarious. Something as simple as `a = b` can call constructors, copy constructors, assignment constructors, move constructors (depending on a lot of details), do implicit type conversion, throw exceptions, etc. etc. In Rust it's just memcpy. Maybe…

C++ hides complexity, yeah, but arguably Rust should have learned from that, no?

Instead, Rust opted to do as much syntactic sugar as possible.

Re: Recent adventures in performance optimization with Rust

#72
The more I use rust, the more I fall in love with writing code again.

This is after many years of corporate java/c#/python/ruby shops. The number of "developers" and "architects" that don't understand low level concepts is draining and disappointing. Worked with too many corporate "code monkeys" that masquerade themselves as "engineers" or "architects". It has got me jaded sometimes.

The author of this post has given me hope that there are people out there willing to push the boundaries of their code with their years of experience and understanding of low level computer concepts.

Definitely bookmarked and will use as reference!

Re: Recent adventures in performance optimization with Rust

#73

I like it how he demonstrates the thought process. It seems quite a mechanical recipe that can be applied to a lot of similar problems: Step 1:. A slow but easy implementation. It allows to make sure the algorithm is correct, and later allows validating the faster variants. Step 2: Algorithm and datastructure optimization, guided by profiling. Step 3: Micro optimization, again guided by profiling. A standard bag of t…

> My point is: it is not magic. It is engineering. It is a skill that can be aquired, thought, even planned and measured.

Unfortunately in this day and age, the art of optimization is lost. Companies are willing to ship shitty code to production and increase performance by throwing more hardware at it.

Re: Recent adventures in performance optimization with Rust

#74
post #71

Earlier quoted context omitted.

> code ends up hiding a lot less complexity than rust code Are you really saying this about C++? For real? I quite like C++ but the idea that it doesn't hide complexity is hilarious. Something as simple as `a = b` can call constructors, copy constructors, assignment constructors, move constructors (depending on a lot of details), do implicit type conversion, throw exceptions, etc. etc. In Rust it's just memcpy. Maybe…

C++ hides complexity, yeah, but arguably Rust should have learned from that, no? Instead, Rust opted to do as much syntactic sugar as possible.

> Rust opted to do as much syntactic sugar as possible.

Of all the criticisms of Rust, this is really the weirdest. What syntactic sugar do you find objectionable in Rust? It has almost none.

Are you talking about macros?

Re: Recent adventures in performance optimization with Rust

#75
Great engineering. Since the article asks about analytical tips for performance improvement: looks like you should be able to substantially get the complexity down using something like least angle regression (ie what's used by efficient implementations of Lasso shrinkage estimators). Or basically any approach where you successively add the most highly correlated variable to your set instead of checking all size-k subsets.
Post reply on HN