-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
perf(atoms): Introduce AtomStoreCell
#8232
Conversation
// SAFETY: We can skip the borrow check of RefCell because | ||
// this API enforces a safe contract. It is slightly faster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment is wrong.
It's safe because of the way we use from the parser, not because of API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use the current API of AtomStoreCell in an unsafe way? (With respect to an UnsafeCell vs RefCell. I'm not sure what's going on internally in AtomStore and Atom)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you are right. The mutable borrow ends in the function.
Can you add this to the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will do it in the morning here.
Maybe we can move this to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
swc-bump:
- swc_atoms
AtomStoreCell
AtomStoreCell
AtomStoreCell
AtomStoreCell
Introduces an
AtomStoreCell
type which internally uses anUnsafeCell
, but enforces a safe contract. This allows skipping the borrow check ofRefCell
.> cargo "bench" "--package" "swc_ecma_parser" "--bench" "parser" "--" "three"
Main: ~37.8ms
This PR: ~37.4ms