Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cache StarlarkDefinedAspect AspectDefinitons
While replacing `java_lite_proto_library` native implementation with Starlarks, a significant regression occurred in retained heap. Inspecting the heap, there were more instances of AspectDefinition and instances of classes used within it. Further inspection of unrelated AspectDefinition showed, that an instance is created for every target that uses a rule with a Starlark aspect. The native aspects already used a cache - implemented in https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/packages/Aspect.java;l=47-54;drc=a4063f6928965e3cc55a18a6b3efff032abb7311 Implement similar cache except for using `weakKeys` (because moving to a different part of the depot, should free those aspects). I considered putting the cache into the same location (`Aspect` class), but that would require refactoring signature of `Aspect.forStarlark` method and there were some preliminary problems with `StarlarkNativeAspect`-s. PiperOrigin-RevId: 447918213
- Loading branch information