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:
Dionisio
2026-03-01 21:47:39 +01:00
parent 81987e9321
commit e2fb29ea60
10 changed files with 88 additions and 34 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ use std::pin::Pin;
/// Metadata of a stored blob in the dedup system.
#[derive(Debug, Clone, Serialize)]
pub struct BlobMetadataDto {
/// SHA-256 hash of the content.
/// BLAKE3 hash of the content.
pub hash: String,
/// Size in bytes.
pub size: u64,
@@ -151,7 +151,7 @@ pub trait DedupPort: Send + Sync + 'static {
/// Returns `true` if the blob was deleted (ref_count reached 0).
async fn remove_reference(&self, hash: &str) -> Result<bool, DomainError>;
/// Calculate SHA-256 hash of a file (streaming).
/// Calculate BLAKE3 hash of a file (streaming).
async fn hash_file(&self, path: &Path) -> Result<String, DomainError>;
/// Get deduplication statistics.