aspect-build / aspect-build/rules_js

[Bug]: memory pressure in Bazel due to non-internable strings

Open
#2,138 0 comments 0 reactions 1 assignee Claimed by @jbedard View on GitHub
bug
Dominant language
Starlark
Stars
378
Forks
183
Avg merge
1d 9h
Merged PRs (30d)
32

Description

### What happened?

A Java Profiler run against Bazel's server reports lots of duplicate string data like

> link attribute cannot be specified when link_packages are set

coming from https://github.com/aspect-build/rules_js/blob/2679d3670885c9222848fb86c95d0e6c187cd2b2/npm/private/npm_import.bzl#L244

Fabian on Bazel slack:
https://bazelbuild.slack.com/archives/CDCMRLS23/p1742380269194209?thread_ts=1742216248.839529&cid=CDCMRLS23
explains this is because .bzl files generated into external repos are not de-duplicated by Bazel.

### Any other information?

Starlark strings are interned **per file**. The same string repeated in multiple files (such as `defs.bzl` of each package) will be duplicated. See [2155](https://github.com/aspect-build/rules_js/pull/2155) and [2157](https://github.com/aspect-build/rules_js/pull/2157) for examples of reducing duplication in those files.

### Related

Some fixes or sources of duplicate strings:
* https://github.com/aspect-build/rules_js/pull/2155
* https://github.com/aspect-build/rules_js/pull/2157

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.