embedding Rust?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

embedding Rust?

Josh Haberman
Is it a design goal of the Rust compiler that it (eventually) be
offered as a library, so that you can compile/link Rust code and
dynamically load / call into it at runtime?

If so, what do you foresee as far as size/speed profile? I get the
impression that the Rust compiler is relatively large/slow (both to
compile rustc itself and to compile Rust code) -- is this inherent or
do you see it slimming/speeding over time? I guess LLVM is pretty
heavyweight on its own.

When it comes to embedding I always compare against LuaJIT which
compiles in ~20 seconds to a  ~500k library and can compile/run "Hello
World" in 5ms. This is surely an unrealistic goal for Rust which has
to do far more static checking, but I'm curious to know what a
realistic ballpark is for where Rust will likely get.

Thanks,
Josh
_______________________________________________
Rust-dev mailing list
[hidden email]
https://mail.mozilla.org/listinfo/rust-dev
Reply | Threaded
Open this post in threaded view
|

Re: embedding Rust?

Patrick Walton
Yes, all of the guts of the compiler are in a dynamic library, librustc, for reasons similar to those.

We have some initial support for loading Rust code at runtime (so that the compiler can load syntax extensions), though it's fairly immature at the moment.

Patrick

Josh Haberman <[hidden email]> wrote:
Is it a design goal of the Rust compiler that it (eventually) be
offered as a library, so that you can compile/link Rust code and
dynamically load / call into it at runtime?

If so, what do you foresee as far as size/speed profile? I get the
impression that the Rust compiler is relatively large/slow (both to
compile rustc itself and to compile Rust code) -- is this inherent or
do you see it slimming/speeding over time? I guess LLVM is pretty
heavyweight on its own.

When it comes to embedding I always compare against LuaJIT which
compiles in ~20 seconds to a ~500k library and can compile/run "Hello
World" in 5ms. This is surely an unrealistic goal for Rust which has
to do far more static checking, but I'm curious to know what a
realistic ballpark is for where Rust will likely get.

Thanks,
Josh


Rust-dev mailing list
[hidden email]
https://mail.mozilla.org/listinfo/rust-dev

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Rust-dev mailing list
[hidden email]
https://mail.mozilla.org/listinfo/rust-dev