perf: replace SHA-256 with BLAKE3 + add mimalloc global allocator
- Replace SHA-256 with BLAKE3 (~5x faster) for content-addressable hashing in dedup_service, file_handler, file_upload_service, chunked_upload_service - Add mimalloc as global allocator for 10-30% throughput improvement - sha2 crate retained only for PKCE (OAuth2 standard requirement) - BLAKE3 produces 64-char hex hashes (same format), no DB schema changes needed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use async_trait::async_trait;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -199,7 +199,7 @@ impl FileUploadUseCase for FileUploadService {
|
||||
tokio::fs::write(temp.path(), content)
|
||||
.await
|
||||
.map_err(|e| DomainError::internal_error("FileUpload", format!("write temp: {e}")))?;
|
||||
let hash = hex::encode(Sha256::digest(content));
|
||||
let hash = blake3::hash(content).to_hex().to_string();
|
||||
|
||||
let file = self
|
||||
.file_write
|
||||
@@ -228,7 +228,7 @@ impl FileUploadUseCase for FileUploadService {
|
||||
tokio::fs::write(temp.path(), content)
|
||||
.await
|
||||
.map_err(|e| DomainError::internal_error("FileUpload", format!("write temp: {e}")))?;
|
||||
let hash = hex::encode(Sha256::digest(content));
|
||||
let hash = blake3::hash(content).to_hex().to_string();
|
||||
|
||||
self.update_file_streaming(
|
||||
path,
|
||||
|
||||
Reference in New Issue
Block a user