|
|
@pcwalton | |||||
|
*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?
|
||||||
|
||||||
|
|
Patrick Walton
@pcwalton
|
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".
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
30. sij |
|
I'm increasingly convinced that the interpreter solution is the only reasonable alternative for Rust.
|
||
|
|
||
|
Rik Arends
@rikarends
|
30. sij |
|
I'm sure i't find use for very rapidly compiled Rust 'things' beit modules or things i can update live.
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
30. sij |
|
I agree! I’m actually bullish on an interpreter as an opt-in compilation mode.
|
||
|
|
||
|
Tristan Hume
@trishume
|
31. sij |
|
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.
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
31. sij |
|
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.
|
||
|
|
||
|
Felipe O. Carvalho
@_Felipe
|
30. sij |
|
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?
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
30. sij |
|
Yes, you can factor into separate crates.
|
||
|
|
||
|
Sebastian Sylvan
@ssylvan
|
31. sij |
|
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?
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
31. sij |
|
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.
|
||
|
|
||
|
Indy Ray
@ScatteredRay
|
31. sij |
|
As a development mode to improve iteration that can be turned off for release? Yes please!
|
||
|
|
||
|
Louis Dureuil
@lodurel
|
30. sij |
|
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.
|
||
|
|
||