Skip to content

Commit

Permalink
perf: calculate js_outs once outside srcs loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Feb 8, 2024
1 parent 5665a00 commit 6bf6610
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion swc/private/swc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def _swc_impl(ctx):
else:
output_sources = []

js_outs_relative = [_relative_to_package(f.path, ctx) for f in ctx.outputs.js_outs]

for src in ctx.files.srcs:
src_args = ctx.actions.args()

Expand All @@ -277,7 +279,7 @@ def _swc_impl(ctx):

src_path = _relative_to_package(src.path, ctx)

js_out_path = _calculate_js_out(src_path, ctx.attr.out_dir, ctx.attr.root_dir, [_relative_to_package(f.path, ctx) for f in ctx.outputs.js_outs])
js_out_path = _calculate_js_out(src_path, ctx.attr.out_dir, ctx.attr.root_dir, js_outs_relative)
if not js_out_path:
# This source file is not a supported src
continue
Expand Down

0 comments on commit 6bf6610

Please sign in to comment.