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

Sandboxed bazel builds with emsdk are slow #1026

Closed
jfirebaugh opened this issue Apr 11, 2022 · 0 comments · Fixed by #1045
Closed

Sandboxed bazel builds with emsdk are slow #1026

jfirebaugh opened this issue Apr 11, 2022 · 0 comments · Fixed by #1045
Assignees

Comments

@jfirebaugh
Copy link
Contributor

I noticed that a wasm_cc_binary target subjectively felt a lot slower to compile than its cc_binary equivalent. During the build, the Bazel java process was consuming 300-400% CPU. I used the --profile flag and it showed that almost all the time was being spent in sandbox.createFileSystem and sandbox.delete. So I used --sandbox_debug and poked into a few of the resulting directories. Each contains 17-18k symlinks, including the following:

  • An emscripten_npm_mac tree containing ~600 directories and ~9k symlinks.
  • An emscripten_bin_mac tree containing ~500 directories and ~8k symlinks.

emsdk is configured in my workspace as follows:

http_archive(
    name = "emsdk",
    sha256 = "7dc13d967705582e11ff62ae143425dbc63c38372f1a1b14f0cb681fda413714",
    strip_prefix = "emsdk-3.1.4/bazel",
    url = "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.4.tar.gz",
    patch_args = ["-p2"],
    patch_tool = "patch",
    patches = [
        "//bazel/patches:0001-Fix-https-github.com-emscripten-core-emsdk-issues-10.patch",
    ],
)

load("@emsdk//:deps.bzl", emsdk_deps = "deps")
emsdk_deps()

load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
emsdk_emscripten_deps(emscripten_version = "3.1.4")

Is there any way to improve / optimize this?

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

Successfully merging a pull request may close this issue.

2 participants