Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

DeepDiff too slow when comparing 2 string arrays. #38

@Gocy015

Description

@Gocy015

Hi,
i am trying to implement a text-base diff viewer, my code looks like the following:

let originalLines = originalSource.split(separator: "\n", omittingEmptySubsequences: false).map{String($0)}


let diffLines = diffSource.split(separator: "\n", omittingEmptySubsequences: false).map{String($0)}
            
            
let algorithmStart = CACurrentMediaTime()
let diffchecker = WagnerFischer<String>(reduceMove: false)
let changes = diffchecker.diff(old: originalLines, new: diffLines)
DC_LOG_INFO("DiffVC, diff algorithm cost \(CACurrentMediaTime() - algorithmStart)")

my sample files are 2 objc source files with 650+lines, and only 1 line is different , and the log prints out:
DiffVC, diff algorithm cost 6.890240641998389

Any idea of why this is so slow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions