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:
20
build.sh
20
build.sh
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================================
|
||||
# build.sh - Build script for filehasher (Linux)
|
||||
# build.sh - Build script (Linux)
|
||||
# Usage: ./build.sh [Release|Debug] [clean]
|
||||
#
|
||||
# Compiler preference: gcc > clang
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_NAME="dfin"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Colors
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -55,7 +57,7 @@ done
|
||||
readonly BUILD_DIR="build/linux/${BUILD_TYPE}"
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
echo -e "${GREEN}=== Building filehasher (${BUILD_TYPE}) ===${NC}"
|
||||
echo -e "${GREEN}=== Building ${PROJECT_NAME} (${BUILD_TYPE}) ===${NC}"
|
||||
echo "Project: ${SCRIPT_DIR}"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -226,18 +228,18 @@ echo
|
||||
# ---------------------------------------------------------------------------
|
||||
cd "${SCRIPT_DIR}"
|
||||
|
||||
if [[ -f "${BUILD_DIR}/filehasher" ]]; then
|
||||
echo -e "${GREEN}Executable: ${BUILD_DIR}/filehasher${NC}"
|
||||
if [[ -f "${BUILD_DIR}/${PROJECT_NAME}" ]]; then
|
||||
echo -e "${GREEN}Executable: ${BUILD_DIR}/${PROJECT_NAME}${NC}"
|
||||
|
||||
if command -v file &> /dev/null; then
|
||||
echo -e " Type: $(file -b ${BUILD_DIR}/filehasher)"
|
||||
echo -e " Type: $(file -b ${BUILD_DIR}/${PROJECT_NAME})"
|
||||
fi
|
||||
|
||||
if command -v du &> /dev/null; then
|
||||
echo -e " Size: $(du -h ${BUILD_DIR}/filehasher | cut -f1)"
|
||||
echo -e " Size: $(du -h ${BUILD_DIR}/${PROJECT_NAME} | cut -f1)"
|
||||
fi
|
||||
elif [[ -f "${BUILD_DIR}/filehasher.exe" ]]; then
|
||||
echo -e "${GREEN}Executable: ${BUILD_DIR}/filehasher.exe${NC}"
|
||||
elif [[ -f "${BUILD_DIR}/${PROJECT_NAME}.exe" ]]; then
|
||||
echo -e "${GREEN}Executable: ${BUILD_DIR}/${PROJECT_NAME}.exe${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}Note: Could not locate executable${NC}"
|
||||
echo "Checking build directory:"
|
||||
@@ -269,4 +271,4 @@ if [[ "${EXPORT_COMPILE_COMMANDS}" == "ON" ]]; then
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -e "${GREEN}Ready to run: ./${BUILD_DIR}/filehasher${NC}"
|
||||
echo -e "${GREEN}Ready to run: ./${BUILD_DIR}/${PROJECT_NAME}${NC}"
|
||||
|
||||
Reference in New Issue
Block a user