Skip to content

Second round of optimizations extracted from PR to implement enum variants #266

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

Merged
merged 6 commits into from
Nov 24, 2024

Conversation

Kijewski
Copy link
Member

No description provided.

pub(crate) enum Source {
Path(String),
Path(Arc<str>),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an Arc and not an Rc btw? Do we need Source to be Send?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other variant Source::Source needs an Arc to be compatible with cached file sources. Source::Path does not, but I think making both variants the same is still the better call. The Clone and Drop implementations are half the size, which I daresay outperforms any drawbacks the use of atomic numbers bring.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, forgot about the static. That answers my question. :)

@GuillaumeGomez GuillaumeGomez merged commit 829ebb0 into askama-rs:master Nov 24, 2024
36 checks passed
@GuillaumeGomez
Copy link
Collaborator

Thanks!

@Kijewski Kijewski deleted the pr-enum-optimizations branch November 24, 2024 19:51
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.

2 participants