{"id":3149,"url":"https://github.com/TumblrArchive/SwiftCompilationPerformanceReporter","last_synced_at":"2025-08-03T13:32:04.033Z","repository":{"id":146361218,"uuid":"57399666","full_name":"TumblrArchive/SwiftCompilationPerformanceReporter","owner":"TumblrArchive","description":"Generate automated reports for slow Swift compilation paths in specific targets","archived":false,"fork":false,"pushed_at":"2016-08-24T18:19:00.000Z","size":28,"stargazers_count":146,"open_issues_count":0,"forks_count":2,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-08-16T10:42:14.630Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TumblrArchive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-04-29T16:51:14.000Z","updated_at":"2023-08-08T18:49:06.000Z","dependencies_parsed_at":"2024-01-02T21:28:28.836Z","dependency_job_id":null,"html_url":"https://github.com/TumblrArchive/SwiftCompilationPerformanceReporter","commit_stats":null,"previous_names":["tumblr/swiftcompilationperformancereporter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TumblrArchive%2FSwiftCompilationPerformanceReporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TumblrArchive%2FSwiftCompilationPerformanceReporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TumblrArchive%2FSwiftCompilationPerformanceReporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TumblrArchive%2FSwiftCompilationPerformanceReporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TumblrArchive","download_url":"https://codeload.github.com/TumblrArchive/SwiftCompilationPerformanceReporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228548567,"owners_count":17935221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:32.816Z","updated_at":"2024-12-07T01:30:37.635Z","avatar_url":"https://github.com/TumblrArchive.png","language":"Swift","funding_links":[],"categories":["Tools"],"sub_categories":["Web View"],"readme":"# SwiftCompilationPerformanceReporter\n\nInspired by [Brian](https://twitter.com/brianmichel/) and [Bryan](https://twitter.com/irace/)'s [prior](https://github.com/brianmichel/Swift-Analysis-Workflow) [work](http://irace.me/swift-profiling), we've decided to develop a Swift Package and script to generate automated reports for slow Swift compilation paths in specific targets!\n\nSwiftCompilationPerformanceReporter (nicknamed SwiftCPR) can be configured to build a specific target, output raw debug times to a specific location, and clean those logs to rank the slowest parts to compile.\n\n## Requirements\n\n- [Xcode 8 Beta](https://developer.apple.com/download/)\n- [8/18/2016 Swift Trunk Development Snapshot](https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-08-18-a/swift-DEVELOPMENT-SNAPSHOT-2016-08-18-a-osx.pkg) (We'll periodically update this repo to work with the latest snapshots)\n\n## Configuration\n\nSwiftCompilationPerformanceReporter can be configured via the `config.json` file. Below is a description of the options available and a sample configuration:\n\n```javascript\n{\n    // Note: either a project or workspace file can be specified, _but not both_\n    \"workspacePath\": \"/Users/jasdev/orangina/Orangina.xcworkspace\",\n    \"projectPath\": \"/Users/jasdev/orangina/Orangina.xcodeproj\",\n\n    \"scheme\": \"Orangina\",\n    \"buildOutputDirectory\": \"/Users/jasdev/Desktop/CompilationLogs/\",\n    \"reportOutputDirectory\": \"/Users/jasdev/Desktop/ProcessedLogs/\",\n    \"limit\": 10\n}\n```\n\n`workspacePath`: The absolute path to the workspace file to use.\n\n`projectPath`: The absolute path to the project file to use.\n\n`scheme`: The scheme to use\n\n`buildOutputDirectory`: The directory to store the raw build output files with Swift compilation times.\n\n`reportOutputDirectory`: The directory to store the processed logs derived from the raw log output.\n\n`limit`: The number of compilation paths to include in the final results (i.e. the slowest `limit` paths that compiler handled).\n\n## Installation\n\n- Simply clone this repository on the machine that will be generating these reports.\n- Run `swift build` in the root directory\n- Make sure all directories used in `config.json` are set properly and exist.\n- If your desired scheme is built with a pre-3.x version of Swift, you'll want to `xcode-select` back to a stable version (i.e. `sudo xcode-select -s /Applications/Xcode.app`)\n- To kick off the script, run `.build/debug/SwiftCompilationPerformanceReporter` in the root directory!\n- If there are any errors, the script will output them.\n- The processed logs will be outputted as timestamped files in `reportOutputDirectory`.\n\n## Output\n\nThe processed logs will be outputted as a tab separated file with 3 columns after the first line (which holds the total build time). All time units are in seconds.\n\n`[Build Time]\\t[Path and Line]\\t[Detailed Description]`\n\nSample output file:\n\n```\nTotal build time: 1214.91016298532\n17.0409\t/Users/jasdev/orangina/Classes/PerformanceLoggingEvent.swift:278:37\tfinal get {}\n7.9331\t/Users/jasdev/orangina/Components/ComposeUI/Classes/Election/LeaderboardTableView.swift:71:17\t@objc final class func totalHeight(candidates: UInt, allowsLeaderboard: Bool) -\u003e CGFloat\n6.2961\t/Users/jasdev/orangina/Classes/UniversalLink.swift:127:25\tprivate final class func dictionaryOfAppArgumentsFromQueryString(string: String) -\u003e [NSObject : AnyObject]?\n4.2116\t/Users/jasdev/orangina/Classes/ActivityViewController.swift:56:22\tfinal get {}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTumblrArchive%2FSwiftCompilationPerformanceReporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTumblrArchive%2FSwiftCompilationPerformanceReporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTumblrArchive%2FSwiftCompilationPerformanceReporter/lists"}