Skip to content

Commit

Permalink
Performance Tuning (#658)
Browse files Browse the repository at this point in the history
Performance Tuning
  • Loading branch information
yonaskolb authored Sep 22, 2019
2 parents 2afab21 + d3bf42f commit e981c72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#### Fixed

- Expand template variable in Array of Any [#651](https://github.com/yonaskolb/XcodeGen/pull/651) @kateinoigakukun
- Significantly improve performance when running with a large number files. [#658](https://github.com/yonaskolb/XcodeGen/pull/658) @kateinoigakukun

## 2.7.0

Expand Down
7 changes: 5 additions & 2 deletions Sources/XcodeGenKit/SourceGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,15 @@ class SourceGenerator {
let groupReference: PBXGroup

if let cachedGroup = groupsByPath[path] {
var cachedGroupChildren = cachedGroup.children
for child in children {
// only add the children that aren't already in the cachedGroup
if !cachedGroup.children.contains(child) {
cachedGroup.children.append(child)
// Check equality by path and sourceTree because XcodeProj.PBXObject.== is very slow.
if !cachedGroupChildren.contains(where: { $0.path == child.path && $0.sourceTree == child.sourceTree }) {
cachedGroupChildren.append(child)
}
}
cachedGroup.children = cachedGroupChildren
groupReference = cachedGroup
} else {

Expand Down

0 comments on commit e981c72

Please sign in to comment.