Stream: project-ffi-unwind

Topic: measuring code size


tmandry (Nov 08 2019 at 07:58, on Zulip):

the rough numbers I have are, panic=abort reduces the size of a binary by 10%-20% on Fuchsia

gnzlbg (Nov 08 2019 at 10:59, on Zulip):

@tmandry it might be interesting to try building fuchsia with -C panic=unwind and a nightly toolchain from July, and then compare that with the current nightly toolchain.

gnzlbg (Nov 08 2019 at 10:59, on Zulip):

IIRC the current toolchain does not emit nounwind for extern C, while the one in July should do that.

gnzlbg (Nov 08 2019 at 11:00, on Zulip):

That would show the impact of this particular change there.

tmandry (Nov 08 2019 at 11:01, on Zulip):

the last numbers I gathered were from July/August timeframe

tmandry (Nov 08 2019 at 11:01, on Zulip):

@gnzlbg if you can point me to a particular change to apply/revert I could also do that

tmandry (Nov 08 2019 at 11:01, on Zulip):

the numbers might be a little noisy with other changes mixed in there

gnzlbg (Nov 08 2019 at 11:03, on Zulip):

@tmandry let me check

gnzlbg (Nov 08 2019 at 11:04, on Zulip):

@RalfJ I see https://github.com/rust-lang/rust/pull/65346 and https://github.com/rust-lang/rust/pull/65020 landed but it appears that none of these removed nounwind from all extern "C" definitions and declarations, did that happen somewhere already?

gnzlbg (Nov 08 2019 at 11:04, on Zulip):

Ah https://github.com/rust-lang/rust/pull/63909 is not merged.

gnzlbg (Nov 08 2019 at 11:04, on Zulip):

@tmandry you might want to apply https://github.com/rust-lang/rust/pull/63909 to the current nightly.

gnzlbg (Nov 08 2019 at 11:05, on Zulip):

then you can just compare the current nightly with that PR, in both cases with -C panic=unwind

gnzlbg (Nov 08 2019 at 11:06, on Zulip):

that should show the effect of making extern "C" definitions and declarations allow unwinding by default

nikomatsakis (Nov 08 2019 at 14:37, on Zulip):

I'm breaking this out into a distinct topic

nikomatsakis (Nov 08 2019 at 14:37, on Zulip):

Thanks @tmandry for those numbers! Very helpful to have an upper bound, and I agree the impact is non-trivial

nikomatsakis (Nov 08 2019 at 14:37, on Zulip):

Given that the impact is non-trivial, it seems like it is worth trying to dig in more, since the impact of these alternatives would be more limited, and it seems like it matters

nikomatsakis (Nov 08 2019 at 16:15, on Zulip):

I think at this point

nikomatsakis (Nov 08 2019 at 16:15, on Zulip):

these measurements are the single most important thing to do

nikomatsakis (Nov 08 2019 at 16:16, on Zulip):

I think @gnzlbg what we really want to compare is

nikomatsakis (Nov 08 2019 at 16:16, on Zulip):

what is the cost if we insert "abort" shims around "C" FFI calls, but otherwise use -Cpanic=abort

nikomatsakis (Nov 08 2019 at 16:16, on Zulip):

I don't think we can estimate that yet, do we need to do a prototype impl to do so?

nikomatsakis (Nov 08 2019 at 16:16, on Zulip):

(Maybe @Amanieu is interested in doing so?)

Kyle Strand (Nov 09 2019 at 00:10, on Zulip):

@nikomatsakis do you have a sense of what threshold should be considered "significant", and how it would impact our design decisions? The data is interesting, but I'm having a little trouble tracking how it will inform our next steps.

Josh Triplett (Nov 09 2019 at 03:45, on Zulip):

The size might determine whether it's reasonable to have C default to unwind or nounwind.

Josh Triplett (Nov 09 2019 at 03:45, on Zulip):

Or at least the impact of those choices.

nikomatsakis (Nov 11 2019 at 21:01, on Zulip):

nikomatsakis do you have a sense of what threshold should be considered "significant", and how it would impact our design decisions? The data is interesting, but I'm having a little trouble tracking how it will inform our next steps.

I feel like 10% is significant

nikomatsakis (Nov 11 2019 at 21:01, on Zulip):

I'm not saying <10% is not significant :)

nikomatsakis (Nov 11 2019 at 21:02, on Zulip):

I guess I think the threshold is probably somewhere around 2 or 3%? I don't really know.

nikomatsakis (Nov 11 2019 at 21:02, on Zulip):

I'd prefer to have the number because there are certain things where it's clear -- 0.1%, or 10% :)

nikomatsakis (Nov 11 2019 at 21:02, on Zulip):

in other words, I don't think there is a firm threshold

Kyle Strand (Nov 11 2019 at 21:59, on Zulip):

Okay, that's fair enough.

Last update: Jan 28 2020 at 01:50UTC