mirror of
https://github.com/sreedevk/deduplicator.git
synced 2026-08-27 18:45:33 +00:00
faster hashing algorithm
This commit is contained in:
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -46,6 +46,12 @@ version = "3.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.3.0"
|
||||
@@ -238,6 +244,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"colored",
|
||||
"fxhash",
|
||||
"glob",
|
||||
"humansize",
|
||||
"itertools",
|
||||
@@ -275,6 +282,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fxhash"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.0"
|
||||
|
||||
@@ -10,6 +10,7 @@ anyhow = "1.0.68"
|
||||
chrono = "0.4.23"
|
||||
clap = { version = "4.0.32", features = ["derive"] }
|
||||
colored = "2.0.0"
|
||||
fxhash = "0.2.1"
|
||||
glob = "0.3.0"
|
||||
humansize = "2.1.2"
|
||||
itertools = "0.10.5"
|
||||
@@ -17,4 +18,3 @@ rayon = "1.6.1"
|
||||
sqlite = "0.30.3"
|
||||
thiserror = "1.0.38"
|
||||
tokio = { version = "1.23.0", features = ["full"] }
|
||||
xxhash-rust = { version = "0.8.6", features = ["xxh3"] }
|
||||
|
||||
@@ -67,6 +67,7 @@ pub fn duplicate_hashes(connection: &sqlite::Connection, path: &String) -> Resul
|
||||
ORDER BY a.file_identifier
|
||||
", path
|
||||
);
|
||||
|
||||
let result: Vec<File> = connection
|
||||
.prepare(query)?
|
||||
.into_iter()
|
||||
|
||||
@@ -48,7 +48,7 @@ pub fn print(duplicates: Vec<File>) {
|
||||
group.into_iter().for_each(|file| {
|
||||
println!(
|
||||
"| {0: <16} | {1: <35} | {2: <16} | {3: <32} |",
|
||||
&file.hash[0..16].red(),
|
||||
file.hash.red(),
|
||||
format_path(&file.path).yellow(),
|
||||
file_size(&file.path).blue(),
|
||||
modified_time(&file.path).blue()
|
||||
|
||||
@@ -6,7 +6,7 @@ use itertools::Itertools;
|
||||
use rayon::prelude::*;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use xxhash_rust::xxh3::xxh3_64 as hasher;
|
||||
use fxhash::hash32 as hasher;
|
||||
|
||||
pub fn duplicates(app_opts: &App, connection: &sqlite::Connection) -> Result<Vec<File>> {
|
||||
let scan_results = scan(app_opts, connection)?;
|
||||
|
||||
Reference in New Issue
Block a user