Twitter | Pretraživanje | |
Patrick Walton 30. sij
Easy to say "monomorphization is awful and Rust should never have done it", harder to say "I want all generic functions to be compiled to bytecode and to embed a Rust interpreter in every binary".
Reply Retweet Označi sa "sviđa mi se"
Patrick Walton 30. sij
Odgovor korisniku/ci @pcwalton
I'm increasingly convinced that the interpreter solution is the only reasonable alternative for Rust.
Reply Retweet Označi sa "sviđa mi se"
Patrick Walton
*I'm* actually OK with this as an opt-in compilation mode, at least for cold functions. But are the people complaining about compilation time OK with it?
Reply Retweet Označi sa "sviđa mi se" More
Rik Arends 30. sij
Odgovor korisniku/ci @pcwalton
I'm sure i't find use for very rapidly compiled Rust 'things' beit modules or things i can update live.
Reply Retweet Označi sa "sviđa mi se"
Patrick Walton 30. sij
Odgovor korisniku/ci @rikarends
I agree! I’m actually bullish on an interpreter as an opt-in compilation mode.
Reply Retweet Označi sa "sviđa mi se"
Tristan Hume 31. sij
Odgovor korisniku/ci @pcwalton
What about Swift witness tables as a kind of half-way? Also I would want interpreted only for newly-needed generic functions in an incremental compile and then my long-running compile process hot-swaps in monomorphized versions when they’re ready.
Reply Retweet Označi sa "sviđa mi se"
Patrick Walton 31. sij
Odgovor korisniku/ci @trishume
We tried witness tables (intensional type analysis). It was a giant mess (I wrote a lot of that code). I suspect it wouldn’t be much faster at runtime than just having an interpreter, and an interpreter would be faster to compile.
Reply Retweet Označi sa "sviđa mi se"
Felipe O. Carvalho 30. sij
Odgovor korisniku/ci @pcwalton
In C++ I can do forward declarations and add virtual interfaces between module boundaries to improve compilation speed (i.e. allow separate compilation). Is that kind of tuning possible with Rust?
Reply Retweet Označi sa "sviđa mi se"
Patrick Walton 30. sij
Odgovor korisniku/ci @_Felipe
Yes, you can factor into separate crates.
Reply Retweet Označi sa "sviđa mi se"
Sebastian Sylvan 31. sij
Odgovor korisniku/ci @pcwalton
Could you explain more why it needs an interpreter and not "just" abstract (via vtable) over all the type things the code depends on (assuming data layout was still monomorphized)? E.g. ask vtable for size, copy function etc. What am I missing?
Reply Retweet Označi sa "sviđa mi se"
Patrick Walton 31. sij
Odgovor korisniku/ci @ssylvan
Because doing so is a giant mess. I wrote a lot of that code early on. I highly suspect that if we did it again it would be just as slow as interpreting the whole function.
Reply Retweet Označi sa "sviđa mi se"
Indy Ray 31. sij
Odgovor korisniku/ci @pcwalton
As a development mode to improve iteration that can be turned off for release? Yes please!
Reply Retweet Označi sa "sviđa mi se"
Louis Dureuil 30. sij
Odgovor korisniku/ci @pcwalton
By interpreter, do you also mean a JIT? I suspect such a thing could also do good with regards to ABI: eg we could instantiate generics at runtime, when they're needed, even when dynamically linking.
Reply Retweet Označi sa "sviđa mi se"