Skip to content

Run proc macro invocations in separate threads. #56058

Description

@eddyb

#49219 introduces proc_macro::bridge::server::{ExecutionStrategy,SameThread,CrossThread}.
SameThread had to be used because CrossThread was a significant performance regression.

Ideally, we'd use CrossThread, which spawns a thread for each invocation, to prevent (and discourage) proc macros from using TLS for state between invocations.

But we'd have to figure out how to make it not regress performance too much, if at all possible.
(it could be the use of channels, which are overkill since they never have more than one value)

cc @dtolnay @alexcrichton @petrochenkov


(TODO: update with regressions, if any, after the cross-thread crater run finishes on #49219)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.I-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions