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

Make Atom Copy #8606

Closed
overlookmotel opened this issue Dec 17, 2024 · 1 comment
Closed

Make Atom Copy #8606

overlookmotel opened this issue Dec 17, 2024 · 1 comment

Comments

@overlookmotel
Copy link
Contributor

Atom is just a wrapper around &str, so could be Copy.

I thought previously that we should avoid making Atom Copy in case we had a future reason for them not to be, like some form of reference-counting.

But now I can't see any such reason. Even if we store hash of string inside Atom (#46), that wouldn't prevent Atom being Copy.

This change would remove a ton of atom.clone() from all over the codebase.

Boshen referenced this issue Jan 19, 2025
Follow up from
#8543 (comment)

> I agree. https://github.com/oxc-project/backlog/issues/155

> Originally we were considering some form of interning and
reference-counting, so we didn't make it Copy to leave the door open for
that. But now all strings are stored in the arena anyway, so even if we
did decide to intern strings, reference-counting would be irrelevant -
our bump allocator doesn't allow freeing individual allocations anyway.

Most of the changes are done automatically by `just fix` (`cargo clippy
--fix` && `cargo fmt --all`). See the commit list for the manual edits.
@overlookmotel overlookmotel transferred this issue from oxc-project/backlog Jan 19, 2025
@overlookmotel
Copy link
Contributor Author

Implemented in #8596.

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

No branches or pull requests

1 participant