Skip to content

Commit 1fc74f6

Browse files
committed
Simplify how we represent single-batch codegen jobs by passing an empty string instead of the full list of object files.
This reduces unnecessary processing for huge modules with hundreds of source files. Cherry-pick: c413bd3
1 parent 370db70 commit 1fc74f6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

swift/internal/compiling.bzl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,24 @@ def _execute_compile_plan(
841841
)
842842
for number, batch in enumerate(batches, 1):
843843
object_prereqs = dict(prerequisites)
844-
object_prereqs["compile_step"] = struct(
845-
action = SWIFT_ACTION_COMPILE_CODEGEN,
846-
output = ",".join([
844+
845+
# If there is only one batch (for small libraries, or libraries of any
846+
# size compiled with whole-module optimization), we omit the requested
847+
# file paths to eliminate some unneeded work in the worker. It will
848+
# treat a blank value as "emit all outputs".
849+
if len(batches) == 1:
850+
step_detail = ""
851+
else:
852+
step_detail = ",".join([
847853
object.path
848854
for invocation in batch
849855
for object in invocation.objects
850-
]),
856+
])
857+
object_prereqs["compile_step"] = struct(
858+
action = SWIFT_ACTION_COMPILE_CODEGEN,
859+
output = step_detail,
851860
)
861+
852862
batch_suffix = ""
853863
if compile_plan.output_nature.emits_multiple_objects:
854864
batch_suffix = " ({} of {})".format(number, len(batches))

0 commit comments

Comments
 (0)