Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add string-based CallSite variant to wrapper enums #320

Closed
wants to merge 1 commit into from
Closed

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 27, 2021

This is a preliminary not-yet-optimized attempt at dtolnay/quote#160. It's currently showing about 20% improvement on the quote crate's benchmark, and passes quote's test suite and serde's test suite. There is still lots more to implement and optimize though.

before after
macro in debug mode 1634μs 1319μs
non-macro in debug mode 998μs 1036μs
macro in release mode 1584μs 1289μs
non-macro in release mode 101μs 98μs

In this draft, currently only the inside_proc_macro() == true side of things has been implemented. Some similar changes would need to be made in the non-macro codepaths because the same optimization of storing spanless tokens as strings is useful there as well.

This is a proc_macro2-only change with no change in the public API i.e. nothing that needs to change in quote to take advantage of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant