@@ -170,18 +170,15 @@ def _get_shared_native_deps_path(
170170 method below is only ensured by validations in the CppLinkAction.Builder.build() method.
171171 """
172172
173- fp = ""
174- for artifact in linker_inputs :
175- fp += artifact .short_path
176- fp += str (len (link_opts ))
177- for opt in link_opts :
178- fp += opt
179- for artifact in linkstamps :
180- fp += artifact .short_path
181- for artifact in build_info_artifacts :
182- fp += artifact .short_path
183- for feature in features :
184- fp += feature
173+ fp = []
174+
175+ # join() is faster than concatenating many strings individually
176+ fp += [a .short_path for a in linker_inputs ]
177+ fp .append (str (len (link_opts )))
178+ fp += link_opts
179+ fp += [a .short_path for a in linkstamps ]
180+ fp += [a .short_path for a in build_info_artifacts ]
181+ fp += features
185182
186183 # Sharing of native dependencies may cause an ActionConflictException when ThinLTO is
187184 # disabled for test and test-only targets that are statically linked, but enabled for other
@@ -190,9 +187,9 @@ def _get_shared_native_deps_path(
190187 # this, we allow creation of multiple artifacts for the shared native library - one shared
191188 # among the test and test-only targets where ThinLTO is disabled, and the other shared among
192189 # other targets where ThinLTO is enabled.
193- fp += "1" if is_test_target_partially_disabled_thin_lto else "0"
190+ fp . append ( "1" if is_test_target_partially_disabled_thin_lto else "0" )
194191
195- fingerprint = "%x" % hash (fp )
192+ fingerprint = "%x" % hash ("" . join ( fp ) )
196193 return "_nativedeps/" + fingerprint
197194
198195def _check_and_get_one_version_attribute (ctx , attr ):
0 commit comments