 /// return `nil` if any element fails to convert.
 ///
 /// - Complexity: O(n), because each element must be checked.
-@inlinable // FIXME(sil-serialize-all)
+@inlinable //for performance reasons
 public func _arrayConditionalCast<SourceElement, TargetElement>(
   _ source: [SourceElement]
 ) -> [TargetElement]? {
-  return try? source.map { try ($0 as? TargetElement).unwrappedOrError() }
+  var successfulCasts = ContiguousArray<TargetElement>()
+  successfulCasts.reserveCapacity(source.count)
+  for element in source {
+    if let casted = element as? TargetElement {
+      successfulCasts.append(casted)
+    } else {
+      return nil
+    }
+  }
+  return Array(successfulCasts)
 }

///
/// - Note: When SourceElement and TargetElement are both bridged verbatim, type
///   checking is deferred until elements are actually accessed.
@inlinable // FIXME(sil-serialize-all)
public func _arrayForceCast<SourceElement, TargetElement>(
  _ source: Array<SourceElement>
) -> Array<TargetElement> {

  return source.map { $0 as! TargetElement }
}

/// Called by the casting machinery.
@_silgen_name("_swift_arrayDownCastConditionalIndirect")
internal func _arrayDownCastConditionalIndirect<SourceValue, TargetValue>(
