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 15:45:57 +01:00
parent 7d2a24d0be
commit 16c6aeae65
8 changed files with 352 additions and 160 deletions

View File

@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "base.h"
@@ -214,19 +214,27 @@ static void mpmc_producers_finished(MPMCQueue *q, u8 consumer_count) {
/* Done */
/* ----------------------------------------------------------- */
static void mpmc_task_done(MPMCQueue *q, u8 consumer_count) {
bool finished = false;
mtx_lock(&q->lock);
if (--q->work_count == 0) {
mpmc_producers_finished(q, consumer_count);
finished = true;
}
mtx_unlock(&q->lock);
if (finished) {
mpmc_producers_finished(q, consumer_count);
}
}
/* ----------------------------------------------------------- */
/* MPMC Cleanup */
/* ----------------------------------------------------------- */
// static void mpmc_finish(MPMCQueue *q) { // Comment to prevent warning: unused function
// static void mpmc_finish(MPMCQueue *q) { // Comment to prevent warning: unused
// function
// if (!q) return;
//
// if (q->slots) {