Skip to content

The deep equality check with _.isEqual() on potentially large profile data objects could be expensive. Consider comparing modification timestamps or checksums first before doing a full object comparison. #39

Description

@ray-pH

The deep equality check with _.isEqual() on potentially large profile data objects could be expensive. Consider comparing modification timestamps or checksums first before doing a full object comparison.

                const remoteModifiedAt = new Date(remoteProfileData.meta.modifiedAt ?? 0);
                const lastSyncTime = new Date(app.lastSyncTime ?? 0);
                const syncDecisionFromTime = this.getSyncDecision(localModifiedAt, remoteModifiedAt, lastSyncTime);
                let syncDecision: SyncDecision;
                if (app.meta.modifiedAt === remoteProfileData.meta.modifiedAt) {
                    // Only do deep equality check if timestamps are equal
                    syncDecision = (_.isEqual(remoteProfileData, app.exportProfile(false))) ? SyncDecision.none : syncDecisionFromTime;
                } else {
                    syncDecision = syncDecisionFromTime;
                }

Originally posted by @Copilot in #37 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogNo planned (unless there are more demands)infrastructureBehind-the-scenes systems, integrations, and stability improvements not visible to users.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions