Vorpal

joined 1 year ago
[–] Vorpal@lemmyrs.org 14 points 1 year ago* (last edited 1 year ago) (6 children)

I saw some other crate doing something similar but using wasm, the idea is to sandbox the binary used as a proc macro. So that seems a bit better. Can't see to find it any more.

EDIT: Found it https://lib.rs/crates/watt

[–] Vorpal@lemmyrs.org 2 points 1 year ago* (last edited 1 year ago)

Debug builds link in <.4 seconds.

With such a small program I expected fixed costs to dominate. Not surprising there is no or almost no difference. You really have to go to cases where linking takes 10s of seconds to see scaling difference, even between ld.bfd and ld.gold.

I did those sort of measurements for my work at the time (a few years ago, before mold was a thing). I have not had the cause or opportunity to measure lld or mold however. Maybe it isn't faster than lld (certainly it seems so for small projects), but I don't think these result say anything useful about larger programs.

The best option is not to take the word of others (myself included) however, but measure on your own application and see which is the best option in your case.

If you however do want to measure linking something big, look at something like Chromium. That isn't rust code though. Not sure what a suitably large rust project would be.

[–] Vorpal@lemmyrs.org 3 points 1 year ago (2 children)
  1. With a total build time of less than 2 minutes, my guess is that link time is fairly small. At work we have a c++ project that takes around 40 minutes to build. Only in the incremental case does link time dominate (upwards of 10 seconds with gold, haven't tried lld or mold).

  2. My understanding is that mold supposedly has more scalable data structures and algorithms (better complexity). Thus for small links there likely will be little difference. So you need to measure it on your actual use case to see if it makes a difference.

  3. mold supposedly can take more advantage of multi core. How many cores did you run on? Again this will likely not show for small links, since there is also overhead in splitting work across threads.

[–] Vorpal@lemmyrs.org 1 points 1 year ago* (last edited 1 year ago)

Well, Rust is MIT + Apache 2.0, so they can do this. It isn't copyleft.

Personally I consider it a a shame that rust and it's ecosystem isn't at least weakly copyleft (e.g. LGPL or MPL) though there are some good reasons not to use those specifically. (LGPL isn't not well defined if you don't use dynamic linking, MPL is younger than rust, but would have been an excellent fit otherwise). And the ecosystem follows the leader for the most part.

But that is neither here nor there, and I'm not interested in arguing about licenses on the Internet. :)