Stream: t-compiler/rust-analyzer

Topic: PSA: we now can count things


matklad (Jan 21 2021 at 16:26, on Zulip):

Curious what do you think about https://github.com/rust-analyzer/rust-analyzer/pull/7378 ?

matklad (Jan 21 2021 at 16:27, on Zulip):

I like it's zero cost nature --- even counting names doesn't slow things down. Although the perf with RA_COUNT=1 is noticiably slower.

matklad (Jan 21 2021 at 16:30, on Zulip):

cc @Jonas Schievink -- might be handy for tracking memory use

Laurențiu (Jan 21 2021 at 16:36, on Zulip):

What's the difference between the max_live loop and fetch_max?

Laurențiu (Jan 21 2021 at 16:42, on Zulip):

And should the cfg be put on the impl in https://github.com/matklad/countme/blob/master/src/lib.rs#L97 to avoid having an empty drop when it's disabled at build-time?

matklad (Jan 21 2021 at 17:06, on Zulip):

What's the difference between the max_live loop and fetch_max?

matklad (Jan 21 2021 at 17:06, on Zulip):

TIL, thanks!

matklad (Jan 21 2021 at 17:12, on Zulip):

And should the cfg be put on the impl in https://github.com/matklad/countme/blob/master/src/lib.rs#L97 to avoid having an empty drop when it's disabled at build-time?

I've thought about that, and decided against. needs_drop might be observable, and I'd like the two versions to have the same API. Hopefully an inline no-op drop is easy to optimize away

Laurențiu (Jan 21 2021 at 17:23, on Zulip):

Good point. I think it affects build times more than the generated code.

matklad (Jan 21 2021 at 17:34, on Zulip):

Yeah, its true that there will be extra fluff in debug, but hopefully not too much

Last update: Jul 27 2021 at 21:15UTC