Skip to content

Commit

Permalink
perf: reduce extension swap when finding alternate extension output (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard authored Feb 8, 2024
1 parent 971d049 commit 2e827b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions swc/private/swc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def _calculate_js_out(src, out_dir = None, root_dir = None, js_outs = []):
# Check if a custom out was requested with a potentially different extension
no_ext = _remove_extension(js_out)
for maybe_out in js_outs:
if no_ext == _remove_extension(maybe_out):
js_out = maybe_out
break
# Initial startswith() check to avoid the expensive _remove_extension()
if maybe_out.startswith(no_ext) and no_ext == _remove_extension(maybe_out):
return maybe_out
return js_out

def _calculate_js_outs(srcs, out_dir = None, root_dir = None):
Expand Down

0 comments on commit 2e827b1

Please sign in to comment.