Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Improvements #179

Merged
merged 1 commit into from
Jul 1, 2020
Merged

Performance Improvements #179

merged 1 commit into from
Jul 1, 2020

Conversation

kyleve
Copy link
Collaborator

@kyleve kyleve commented Jul 1, 2020

No description provided.

@kyleve kyleve force-pushed the kve/diff-fast-path branch from 6d362ac to db0a1cc Compare July 1, 2020 03:27
@@ -83,6 +84,7 @@ fileprivate struct XcodePreviewDemoContent : BlueprintItemContent, Equatable
}
}

#if DEBUG && canImport(SwiftUI) && !arch(i386) && !arch(arm)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes building for profiling in Instruments

@@ -8,17 +8,21 @@
import Foundation


public final class AnyIdentifier : Hashable, CustomDebugStringConvertible
public class AnyIdentifier : Hashable, CustomDebugStringConvertible
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to a class hierarchy allows free bridging to the Any type

@@ -8,7 +8,7 @@
import Foundation


struct ArrayDiff<Element>
struct ArrayDiff<Element, Identifier:Hashable>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not wrapping in AnyHashable saves many allocs and function calls; which add up.

@@ -27,14 +27,6 @@ struct SectionedDiff<Section, Item>
)
}

static func calculate(on queue : DispatchQueue, old : [Section], new: [Section], configuration : Configuration, completion : @escaping (SectionedDiff) -> ())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

@@ -8,7 +8,7 @@
import Foundation


struct SectionedDiff<Section, Item>
struct SectionedDiff<Section, SectionIdentifier:Hashable, Item, ItemIdentifier:Hashable>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to the direct type saves trampolining through AnyHashable, which is faster for large diffs.

@@ -9,23 +9,6 @@ import XCTest
import Listable


class AnyIdentifierTests: XCTestCase
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now an abstract type; no longer useful to test.

@kyleve kyleve merged commit f5b51c1 into main Jul 1, 2020
@kyleve kyleve deleted the kve/diff-fast-path branch July 1, 2020 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant