gpt4 book ai didi

ios - XCode 8 编译真的很慢,SourceKitService 使用 300+ % CPU

转载 作者:行者123 更新时间:2023-11-28 19:32:34 26 4
gpt4 key购买 nike

我的 Xcode 编译起来真的很慢。事件监视器显示 SourceKitService 的 CPU 使用率约为 330%,swift 为 100%。那里有什么异常吗?

我在一些地方读到 SourceKitService 可能很难猜测数组和字典类型,所以我会尽量让它们更明确。由于这些帖子来自 Xcode 5-6,我想知道这是否仍然是个问题

最佳答案

感谢@Mike 提供构建时间分析器的链接,它很棒。事实证明,XCode 仅需 330 秒即可编译:

func asJson() -> JSON {
let dict: [String: Any?] = [
"video": video.asJson,
"asset": asset.url.path,
"canBeShared": canBeShared,
"videoSource": videoSource.path,
"previewSource": previewSource.documentPath,
"expectedResizedVideo": expectedResizedVideo.documentPath,
"videoDestination": videoDestination,
"previewDestination": previewDestination,
"fileId": fileId,
"isRecordCreated": isRecordCreated,
"isPreviewUploaded": isPreviewUploaded,
"isPreviewRegistered": isPreviewRegistered,
"isSharingPreviewReady": isSharingPreviewReady,
"isVideoUploaded": isVideoUploaded,
"isVideoRegistered": isVideoRegistered,
"isPosted": isPosted,
"isPostRegistered": isPostRegistered,
"didResizeVideo": didResizeVideo,
]
return JSON(dict)
}

我重写为

func asJson() -> JSON {
var dict = [String: Any?]()
dict["video"] = video.asJson
dict["asset"] = asset.url.path
dict["canBeShared"] = canBeShared
dict["videoSource"] = videoSource.path
dict["previewSource"] = previewSource.documentPath
dict["expectedResizedVideo"] = expectedResizedVideo.documentPath
dict["videoDestination"] = videoDestination
dict["previewDestination"] = previewDestination
dict["fileId"] = fileId
dict["isRecordCreated"] = isRecordCreated
dict["isPreviewUploaded"] = isPreviewUploaded
dict["isPreviewRegistered"] = isPreviewRegistered
dict["isSharingPreviewReady"] = isSharingPreviewReady
dict["isVideoUploaded"] = isVideoUploaded
dict["isVideoRegistered"] = isVideoRegistered
dict["isPosted"] = isPosted
dict["isPostRegistered"] = isPostRegistered
dict["didResizeVideo"] = didResizeVideo
return JSON(dict)
}

而且效果很好。我会用 Apple 打开一个 bug

关于ios - XCode 8 编译真的很慢,SourceKitService 使用 300+ % CPU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42310095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com