Minor optimisations and bug fixes

Fix bug in mt_mpmc.c, in Linux mutexes are not recursive.
Add arena_trim_string() to the arena API
Removing arena->path, now paths are pushed to arena->metadata
Replacing fe->owner[128] with char *owner; the owner is not pushed as a
string to arena->metadata and trimed with arena_trim_string()
Improving cache locality in arena->metadata, the memory layout is not
fe; fe->path; fe->owner.
Cache aligning all arenas except HasherContext->arena to sizeof(void *).
Pushing elements one by one instead of snprintf() in finalize_file() and
hash_worker().
Getting the full path of current directory instead of "."
Fixing bug in path formating, this allow us to remove normalize_path()
from the hot loop.
This commit is contained in:
2026-05-08 20:06:48 +01:00
parent 2076a2d035
commit f37e915489
9 changed files with 353 additions and 164 deletions

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)
project(filehasher
project(dfin
VERSION 1.0.0
DESCRIPTION "High-performance file hasher with I/O Ring/io_uring support"
DESCRIPTION "High-performance duplicate finder with I/O Ring/io_uring support"
LANGUAGES C
)
@@ -106,7 +106,7 @@ endif()
# ---------------------------------------------------------------------------
set(SOURCES
file_hasher.c
duplicate_finder.c
xxhash.c
xxh_x86dispatch.c
)
@@ -116,7 +116,7 @@ set(HEADERS
arena.h
base.h
xxhash.h
lf_mpmc.h
mt_mpmc.h
)
# ---------------------------------------------------------------------------
@@ -281,4 +281,4 @@ message(STATUS " Compiler: ${CMAKE_C_COMPILER}")
message(STATUS " Build Type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Generator: ${CMAKE_GENERATOR}")
message(STATUS " Platform: ${PLATFORM_NAME}")
message(STATUS "----------------------------------------")
message(STATUS "----------------------------------------")