Skip to content

Commit

Permalink
Remove expensive filter (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Oct 27, 2023
1 parent e498853 commit c88be42
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Sources/VergeORM/Derived+ORM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ struct _DatabaseSingleEntityPipeline<Source: Equatable, Database: DatabaseType,
let keyPathToDatabase: KeyPath<Source, Database>
let entityID: Entity.EntityID

private let noChangesComparer: OrComparison<DatabaseComparisons<Database>.DatabaseComparison.Input, OrComparison<DatabaseComparisons<Database>.DatabaseComparison.Input, DatabaseComparisons<Database>.DatabaseComparison, DatabaseComparisons<Database>.TableComparison<Entity>>, DatabaseComparisons<Database>.UpdateComparison<Entity>>
private let noChangesComparer: OrComparison<DatabaseComparisons<Database>.DatabaseComparison.Input, DatabaseComparisons<Database>.DatabaseComparison, DatabaseComparisons<Database>.UpdateComparison<Entity>>

init(
keyPathToDatabase: KeyPath<Source, Database>,
Expand All @@ -425,11 +425,7 @@ struct _DatabaseSingleEntityPipeline<Source: Equatable, Database: DatabaseType,
self.keyPathToDatabase = keyPathToDatabase
self.entityID = entityID

/** Step 1 */
noChangesComparer = DatabaseComparisons<Database>.DatabaseComparison()
/** Step 2 */
.or(DatabaseComparisons<Database>.TableComparison<Entity>())
/** Step 3 */
.or(DatabaseComparisons<Database>.UpdateComparison(entityID: entityID))

}
Expand Down Expand Up @@ -478,7 +474,7 @@ struct _DatabaseCachedSingleEntityPipeline<Source: Equatable, Database: Database
let keyPathToDatabase: KeyPath<Source, Database>
let entityID: Entity.EntityID

private let noChangesComparer: OrComparison<DatabaseComparisons<Database>.DatabaseComparison.Input, OrComparison<DatabaseComparisons<Database>.DatabaseComparison.Input, DatabaseComparisons<Database>.DatabaseComparison, DatabaseComparisons<Database>.TableComparison<Entity>>, DatabaseComparisons<Database>.UpdateComparison<Entity>>
private let noChangesComparer: OrComparison<DatabaseComparisons<Database>.DatabaseComparison.Input, DatabaseComparisons<Database>.DatabaseComparison, DatabaseComparisons<Database>.UpdateComparison<Entity>>

private let latestValue: VergeConcurrency.RecursiveLockAtomic<Entity>

Expand All @@ -491,11 +487,8 @@ struct _DatabaseCachedSingleEntityPipeline<Source: Equatable, Database: Database
self.entityID = entity.entityID
self.latestValue = .init(entity)

/** Step 1 */

noChangesComparer = DatabaseComparisons<Database>.DatabaseComparison()
/** Step 2 */
.or(DatabaseComparisons<Database>.TableComparison<Entity>())
/** Step 3 */
.or(DatabaseComparisons<Database>.UpdateComparison(entityID: entityID))

}
Expand Down

0 comments on commit c88be42

Please sign in to comment.