Live data from Hacker News

Everything Is Broken: Shipping Rust-Minidump at Mozilla

hacks.mozilla.org

61–67 of 67 posts

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#63

Earlier quoted context omitted.

So far I have found no Rust insertion-ordered collections which supports removing items without scrambling items (necessary for editing a key-value INI file) with O(log n) reads/writes, though you can use a vector with O(n) accesses which takes O(n^2) to lookup every key, which is probably good enough in most cases. And non-tree-shaped object graphs are not a library concern, but permeate entire applications; if you…

It seems that indexmap would fit your bill: Repo: https://github.com/bluss/indexmap IndexMap type itself: https://docs.rs/indexmap/latest/indexmap/map/struct.IndexMap... It has amortized O(1) reads and writes, and it supports removal without maintaining order in O(1), or while maintaining order in O(n).

I was not initially aware of O(n) order-preserving shift_remove[...](). Although likely not a problem in practice, removing a large number of items one by one (eg. when a user is deleting a selection containing many file associations) can result in quadratic behavior. I found that you can avoid that by calling retain() (at the cost of being a higher-order function) to keep/remove every item in the list in a single pass (linear time is fast enough for INI files). So in retrospect IndexMap would be a workable choice, if used carefully.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#64

I wonder how much of the benefits comes from the rewrite itself and not Rust. I have taken really bad hard to maintain very large code bases written in C++ and step-by-step refactored it into bug free maintainable code. In my experience bad code written in any language is hard to maintain. And good code written in any language is easy to maintain. I have worked with C code that was a joy to maintain and C code that w…

Original rust-minidump author here: I started out by doing a pretty straightforward port of Breakpad into Rust, which I had just started learning at the time. I figured that learning a new language by porting a codebase I was intimately familiar with for a content area that I knew extremely well would make it so only the new language was the hard part. (It worked out well!) I did try to make the API more idiomatic Ru…

Yep makes sense. My point was that the developers matter more than the language. However you are absolutely right that good developers with a better language will do better.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#65

Earlier quoted context omitted.

> Sure, you can write bad code in any language, but C and C++ are just bad languages. Let's give them credit for what we've achieved using them. I would definitely pick Rust over C++ any time, I respect C++ for all the cool things it gave us.

If they are bad languages then you should give most of the credit to the programmers that were using them.

I wish I could upvote this more than once :) The unsung heroes out there are the developers who takes over a garbage dump of a system and turn it around. That is way harder than writing a system from scratch.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#66

I wonder how much of the benefits comes from the rewrite itself and not Rust. I have taken really bad hard to maintain very large code bases written in C++ and step-by-step refactored it into bug free maintainable code. In my experience bad code written in any language is hard to maintain. And good code written in any language is easy to maintain. I have worked with C code that was a joy to maintain and C code that w…

There are entire classes of bugs that cannot happen in (safe) Rust that can still happen in a “bug free” C++ code based. You’re correct that Rust isn’t a panacea, but it does eliminate certain concerns that C++ just can not remove from thought while developing with it. The great thing about Rust is that it reduces the knowledge and skill a developer needs in order to write a stable and (usually) performant program. T…

I completely agree with you. Rust seems to be a good step forward.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#67
post #24

Earlier quoted context omitted.

> you can't trust that your enums have a value inside their interval If you don't set the underlying type, assigning a value that doesn't match an enumerator via `static_cast` is undefined behavior. See https://en.cppreference.com/w/cpp/language/enum . (Doing weird pointer casting things is also undefined behavior per the strict aliasing rule, though, come to think of it, I'm not sure whether memcpying an out-of-rang…

I’m assuming you are referring to this part: > If the underlying type is not fixed and the source value is out of range, the behavior is undefined. Note the fine print about the meaning of ”out of range”: > (The source value, as converted to the enumeration's underlying type if floating-point, is in range if it would fit in the smallest bit field large enough to hold all enumerators of the target enumeration.) So thi…

Ugh. You are right, and that's sad.
Post reply on HN