dagw 15 minutes ago

Wow! At least for me this is by far the best, clearest and most useful quick intro to Rust I've seen.

kookamamie 3 hours ago

AFAIK, auto-vectorization has the same limitation in Rust as in C and C++ - it cannot be required. Hence, it is very easy to break the vectorization in brittle ways, without even noticing the issue.

It would be nice to have a sort of autovec-or-error annotation for preventing this.

  • dwattttt 2 hours ago

    Rust is experimenting with "portable SIMD": https://doc.rust-lang.org/std/simd/index.html

    It defines a generic `Simd<T, N>` type, expressing "This is a vector of T elements (such as i8), and is present in chunks of N". Methods that are easily vectorisable are defined on it, so if you can express what you want to do with one, you'll get well defined vectorised operations. Maybe not as perfect as you could hand write if you know what you're doing, but it _does_ guarantee to use vector instructions, so you're not at the behest of the compiler recognising a loop idiom.

    • kookamamie an hour ago

      Yes, that's a variant of manual vectorization. However, AFAIK Rust doesn't provide dynamic dispatching as part of the portable SIMD? If this is the case, ISPC still looks like a better option, I think, albeit it is unlikely to be seen as the Rusty way of doing things.

davidhyde 2 hours ago

If you learned Rust first but find yourself reading a lot of C then this is also a good thing to read because of the parallels it draws with the languages.

0xpgm 2 hours ago

Reminds me of Learn x the hard way series by Zedshaw

einpoklum 3 hours ago

TL;DR: An introduction to Rust which starts with a Rust-unsafe C program, writing a Rust equivalent, then evolves it towards some of the higher-level abstractions in Rust.

(As opposed to the non-dangerous way which means writing safe code to begin with and mentioning unsafe as the exception)