Live data from Hacker News

Announcing Rust 1.27

blog.rust-lang.org

61–70 of 80 posts

Re: Announcing Rust 1.27

#61
post #59

Earlier quoted context omitted.

Wasm doesn’t support SIMD yet, so no way to tell.

Thanks, wasn't able to easily discern how far along the browser SIMD wasm implementations were. Do you see a future where wasm has its own std::arch module?

Yeah, SIMD is on the wasm roadmap; we’ll see what form that takes for exact details, but that’s what I’d expect.

Re: Announcing Rust 1.27

#62
post #52

Earlier quoted context omitted.

Not slated any time soon. There are major questions about the approach; the current implementation is "do whatever LLVM does" which is not in itself stable, and so cannot be our final implementation.

clang manages with "Do whatever gcc does" I wonder why that isn't good enough. Doing nothing useful now as we might want to do something more useful later than what we can now seems a bit self defeating, but I may be missing the point because I want to us inline assembly language in unsafe blocks.

Clang isn't using LLVM's inline asm directly, it translates from the (stable) GCC format into the internal LLVM one. rustc could theoretically do the same translation, but implementing that is significantly more work than just stabilizing the current implementation of asm!().

Re: Announcing Rust 1.27

#63
post #36

Anyone happen to know when inline asm will hit stable?

What exactly are you wanting to do with it? There's a few different things might want, and for many of them, there may be alternatives that work just as well, if not better (e.g. instrinsics for the operations like SIMD: https://github.com/rust-lang-nursery/embedded-wg/issues/63).

Re: Announcing Rust 1.27

#64

SIMD on stable is very exciting news. SIMD unlocks the power of the GPU-esque parallelism that is already inside your CPU. While compilers do try very hard to take advantage of this automatically, it’s not always predictable and can make performance fragile. This is what people are talking about when they refer to “low level control”. Don’t expect that with Rust 1.27 you’ll need to understand SIMD to get anything don…

How useful is SIMD on CPU these days given that most of the touted original applications (back in the MMX SSE days) have been moved over to GPUs?

I recently ported some code to use AVX intrinsics. The performance gain is somewhere from 30x to 3000x depending on the size of the array. The larger the array the more performance gain I get. It’s linear algebra but not related to matrix multiplication that I could mention.

Re: Announcing Rust 1.27

#65
post #9

Earlier quoted context omitted.

Still really useful. We use NEON on Android all the time since there's not a great API there and spinning up a GPU on a mobile device is not something you want to do unless you absolutely have to.

> We use NEON on Android all the time since there's not a great API there and spinning up a GPU on a mobile device is not something you want to do unless you absolutely have to. True regarding Android's APIs being awful, but taken literally, your statement implies that even Core Animation on-GPU compositing from 2007 is bad, which I'm sure you didn't mean. :)

Yeah, this is all with in the context of compute, of course GPUs are going to be great at rasterizing(although they're rarely used for blitting/compositing different layers as there's discrete hardware that's even better for that).

Re: Announcing Rust 1.27

#66
post #46

Earlier quoted context omitted.

>We have to keep the old syntax working for stability reasons Will Rust 2018 enable you to remove the old syntax? Or is that a bigger change than the opt-in is allowed to cover?

This kind of change is the kind an edition can make, though I’m not 100% sure if the plan for 2018 is to warn or error on the older syntax.

I feel like a warning for one edition and error on the next would make it straightforward as to how much time is left to update the code.

Re: Announcing Rust 1.27

#67
post #31

Earlier quoted context omitted.

Ah ok, I'm back to being confused again then! Is this right: If Foo is a struct then Box is static dispatch. If Foo is a trait Box is dynamic dispatch, but then so is Box - but that is the regrettable point. So from now on, if Foo is a trait we should be writing Box , which is largely syntactic sugar to make the situation more clear? I don't fully understand what the release notes are saying about using impl Trait. W…

You are right. It’s not that you would use Box , but when taking about the two features, it’s easier to compare them, as they’re actually distinct syntactically.

Thankyou.

Re: Announcing Rust 1.27

#68
post #35

Earlier quoted context omitted.

>This is one way that rust is different than C++; the vtable isn’t stored with the data Which “data” is the vtable stored with in C++? An object contains only a pointer to its vtable, not the vtable itself...

My understanding is that, generally (because (again in my understanding) this is all compiler-specific, not mandated by the standard) is that in C++, there's a single pointer that points to the combo of the vtable and then the data, after it. See http://www.drdobbs.com/cpp/storage-layout-of-polymorphic-obj... for example. While a Shape is a position, outline, and fill, if you have virtual functions, the pointer point…

That’s absolutely correct.

I get it now, that you meant the “pointer to the vtable” under “vtable” in your original post.

Re: Announcing Rust 1.27

#69
post #62
post #52

Earlier quoted context omitted.

clang manages with "Do whatever gcc does" I wonder why that isn't good enough. Doing nothing useful now as we might want to do something more useful later than what we can now seems a bit self defeating, but I may be missing the point because I want to us inline assembly language in unsafe blocks.

Clang isn't using LLVM's inline asm directly, it translates from the (stable) GCC format into the internal LLVM one. rustc could theoretically do the same translation, but implementing that is significantly more work than just stabilizing the current implementation of asm!().

That and GCC's format is not exactly great. I'm generally looking unfavorably towards NIH but in this instance I really hope they figure out something better.

Re: Announcing Rust 1.27

#70
post #4

Earlier quoted context omitted.

> Rust’s trait object syntax is one that we ultimately regret. Would someone please explain the problem (and the solution) for someone who doesn't know Rust yet?

A trait is like an interface. A struct implementing a trait means it takes on the methods of that interface (but there's more to it, because a trait can have default implementations of of the trait methods). If you want to express something like "this is a variable that holds something that fulfils this trait", without knowing the _actual_ type it is, that variable effectively has an unknown runtime size. std::io::Re…

The linked port says that it has proven to be a bad design decision specifically in the contect of "impl Read" etc. Can you give an example of that, and why it was confusing before?
Post reply on HN