-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Intern global map_each
functions in VectorArg
s
#23685
Conversation
6d5309a
to
5029f91
Compare
@justinhorvitz Friendly ping |
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.
Saves 8MB (0.1%) on a benchmark build.
What's the motivation for using reference equality in
While the statement about |
I may have misunderstood how |
Ok, I think I understand. So currently the interner interns the The general concern with reference equality in Starlark values is that it introduces the possibility that what should be an identical re-evaluation of Starlark code produces behaviorally different results. Since We also use reference equality in |
I refer to this phenomenon as "interner resurrection," which I coined when working on https://cs.opensource.google/bazel/bazel/+/f6344ffcacdea6c4a61e112d0f60beda8068eac5. We can keep a weakly-referenced object alive by getting an interner hit before a GC collects it, and then we have duplicates. I will update the code comment to make the intent more clear. |
Intern global Starlark functions in the VectorArg as they can be reused for all rule instances (and possibly even across multiple Args.add_all calls).