posixutils-rs icon indicating copy to clipboard operation
posixutils-rs copied to clipboard

`diff`: fix poor performance

Open andrewliebenow opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. diff appears to process files multiple orders of magnitude slower than other implementations:

❯ time -- diff -- ./file-a ./file-b
Elapsed time: 3.381272 seconds
User time: 0.000000 seconds
System time: 0.000000 seconds

❯ time -- diffutils -- ./file-a ./file-b
Elapsed time: 0.005884 seconds
User time: 0.000000 seconds
System time: 0.000000 seconds

❯ du -k -- ./file-a ./file-b
1384    ./file-a
1384    ./file-b

In this case, file-a and file-b are identical.

Describe the solution you'd like I think we should aim for diff to be able to process files at 10 mebibytes per second, at the very least (on my system, the current implementation is getting less than 0.5 mebibytes per second). On my system, diffutils from uutils does over 200 mebibytes per second.

Describe alternatives you've considered N/A

Additional context N/A

andrewliebenow avatar Sep 20 '24 14:09 andrewliebenow