Compare commits

..
93 Commits
Author SHA1 Message Date
retoor 903ff442fc feat: add profile-guided optimization build step and aggressive compiler flags to Makefile
isspam build / build (push) Successful in 2m58s
- Replace basic -O3 with -Ofast and add PGO instrumentation (fprofile-generate) and usage (fprofile-use) stages in the default 'build' target
- Introduce new 'build_quick' target for compilation without PGO
- Add numerous performance-oriented flags: fipa-pta, fipa-cp-clone, fdevirtualize-speculatively, fno-plt, fno-semantic-interposition, fomit-frame-pointer, fmerge-all-constants, fno-stack-protector, DNDEBUG, and floating-point relaxation flags
- Update linker flags to use flto=auto and fuse-linker-plugin
- Include training runs on spam, not_spam, and optional books directories during PGO instrumentation phase
2026-02-03 09:55:16 +00:00
retoor 2f0d088beb feat: add Swift implementation of isspam (sisspam) with CI build and benchmark integration
- Add swift_isspam package with optimized main.swift using unsafe memory flags
- Extend CI workflow to install Swift 5.9.2 and include sisspam in build_all and benchmark
- Update Makefile with build_swift target and publish step for sisspam binary
- Add sisspam to .gitignore and README with author credit
- Enable Swift timing in bench.py alongside existing language implementations
2026-02-03 01:24:34 +00:00
retoor 39c9bfb36f chore: remove Rust-based trie spam detection and restore pure C implementation 2025-12-14 20:09:30 +00:00
retoor d86aab450c feat: replace naive text analysis with SIMD-optimized trie-based multi-threaded spam detector
Rewrite the isspam.c program to use memory-mapped files, a compact trie data structure for forbidden word lookup, and pthread-based parallel processing across up to 16 threads. Remove the old fixed-size buffer and linear forbidden word array in favor of a SIMD-accelerated scanning approach with AVX2 instructions. Update the Makefile to enable aggressive x86-64 optimization flags including -march=native, -flto, -ffast-math, and -mavx2 for maximum performance on supported hardware.
2025-10-07 18:20:58 +00:00
12bitfloat 9118d88eab fix: remove commented-out debug timing and file-reading code from work function 2025-10-06 23:03:56 +00:00
12bitfloat dc3533c8f6 chore: add isspam.py to gitignore to prevent accidental tracking 2025-10-06 22:57:51 +00:00
12bitfloat 5c50a45101 fix: comment out slow python3 benchmark section in bench.py
The Python benchmark using isspam.py was removed from the benchmark
run because its execution time was excessively slow compared to the
C++ and Rust implementations, skewing overall timing results.
2025-10-06 22:56:44 +00:00
12bitfloat e516f5e869 feat: add initial SIMD analysis and io_uring module, drop core_affinity and memmap2 deps
Introduce a new `analyze_simd` function in main.rs using AVX2 256-bit registers for parallel text scanning, replacing the previous sequential analysis path. Add a stub `uring` module for future async I/O integration. Remove `core_affinity` and `memmap2` crate dependencies from Cargo.toml and Cargo.lock, along with their associated `libc`, `num_cpus`, `hermit-abi`, and `winapi` transitive dependencies. Comment out `mimalloc` and `io-uring` crate references. Uncomment file reading timing instrumentation and add a `bench_rust_only` Makefile target for direct benchmark execution.
2025-10-06 22:55:06 +00:00
12bitfloat 83f3729670 fix: remove cargo env sourcing and prefix build steps with cargo bin path 2025-10-06 22:32:25 +00:00
12bitfloat 7e0bb8ea88 fix: source cargo environment before build steps in gitea workflow
The CI workflow was failing because the Rust toolchain installed via rustup
was not available in subsequent steps. Adding `. "$HOME/.cargo/env"` ensures
the cargo and rustc binaries are on PATH before the build commands execute.
2025-10-06 22:18:30 +00:00
12bitfloat 76aaf79365 chore: remove individual build/run steps and replace with combined build_all target 2025-10-06 22:14:21 +00:00
JestDotty 11a4974ff3 chore: remove stale performance comments from for_loops and muncher parsers 2025-10-06 15:58:01 +00:00
12bitfloat 46282684b3 fix: correct .gitignore trailing slashes and add missing risspam rust source files 2025-10-06 15:43:44 +00:00
12bitfloat bb97bff828 docs: add build_all target and benchmark_only shortcut to Makefile, update README with version credits and build instructions 2025-10-06 11:52:54 +00:00
12bitfloat 12d83c4ae1 fix: suppress dead_code and unused import warnings in risspam main.rs
- Added `#![allow(dead_code)]` attribute to suppress warnings for unused items
- Removed unused imports: `Mmap`, `CoreId`, `OnceCell`, `OsString`, `File`, `assert_unchecked`, `MaybeUninit`, `Deref`, `stat`, `FileExt`, `OpenOptionsExt`, `fs`, `mem`, `thread`
- Commented out unused variable `do_parallel` to silence unused variable warning
- Added `#[allow(unused_mut)]` attribute on `stats` variable with safety justification comment
- Fixed variable name from `num_cores` to `num_threads` in `ThreadPoolBuilder::num_threads()` call
2025-10-06 11:45:18 +00:00
12bitfloat 2468b85451 perf: add core_affinity and memmap2 dependencies, switch to edition 2024, and rewrite main.rs with mmap-based parallel file processing 2025-10-06 11:39:29 +00:00
JestDotty 1cc1df976c docs: add benchmark observation that FxHashMap outperforms BTreeMap in README 2025-10-04 14:03:15 +00:00
JestDotty 8c5938786e chore: add for_loops_forbidden_only parser and switch to fat LTO in release profile 2025-10-04 13:58:40 +00:00
JestDotty 93cf77cb96 refactor: extract parser module with muncher and for_loops submodules from main.rs
Move Stats processing methods into dedicated parser module with separate muncher and for_loops implementations, update .gitignore to exclude test_books directory, and simplify README to remove outdated benchmark instructions
2025-10-04 13:18:03 +00:00
JestDotty 305d2d5243 perf: move file reading out of async tasks to reduce sequential I/O overhead
The change shifts `fs::read_to_string` from inside each spawned async task into the main synchronous loop before spawning. This eliminates redundant sequential file reads across concurrent tasks, yielding a ~30ms improvement on NVMe SSD workloads. The `Stats::process` method now accepts a pre-read `&str` instead of a file path, and failed file counts are tracked directly in the main loop.
2025-03-24 20:03:36 +00:00
JestDotty 8bfd58b613 docs: add compile options benchmarks and restructure forbidden words benchmarks in README 2025-03-24 04:48:04 +00:00
JestDotty 62310e09a5 feat: replace thread-local LazyCell with static LazyLock and add fxhash-backed trie children for 24% speedup 2025-03-24 04:20:15 +00:00
JestDotty 40cb4f8cff feat: replace static forbidden word list with trie-based lookup for 3x speedup
Extract Stats struct into its own module with public fields and AddAssign/Display impls; introduce Trie data structure with insert and contains methods; refactor main.rs to use thread-local LazyCell<Trie> populated from the same forbidden word set; update README with trie benchmark results showing 1588ms vs 4737ms original.
2025-03-24 03:58:34 +00:00
JestDotty 12a95bb8d8 fix: add break to forbidden word loops to count each word only once in for_loops method 2025-03-24 03:23:40 +00:00
JestDotty 7c87f28599 feat: add muncher-based text analysis with benchmark data and README results
Implement a character-level muncher parser as an alternative to the existing for-loop approach for text statistics. The muncher processes text by tracking whitespace and dot states to count words, sentences, capitalized words, and numeric characters. Benchmark results show the muncher completes in 504ms versus 5033ms for for-loops, though with different counts for capitalized words (16% vs 2%) and forbidden words (0% vs 2%) due to implementation differences. The README now includes both benchmark comparisons and data integrity notes documenting the statistical discrepancies between the two methods.
2025-03-24 03:14:30 +00:00
JestDotty 4d42726854 chore: remove jest_rust Cargo.lock from version control to stop tracking generated dependencies 2025-03-24 02:31:14 +00:00
JestDotty 32fda51edd feat: replace rayon parallel iteration with tokio async mpsc channels for file processing 2025-03-24 02:29:54 +00:00
JestDotty 144fc9b2ac chore: add rayon parallel dependency and release profile optimizations to jest_rust
Add rayon 1.10.0 as a dependency in Cargo.toml and refactor Stats processing into a dedicated method that uses `par_iter()` for parallel file processing. Configure release profile with thin LTO, disabled debug symbols, and abort-on-panic for maximum runtime performance. Update README with build and benchmark integration instructions for the jest_rust project.
2025-03-24 01:39:12 +00:00
retoor 114e596105 chore: add isspam.py to gitignore and refactor forbidden_words list to set with ThreadPoolExecutor 2025-03-24 01:31:28 +00:00
Jest Dotty 5efa63f648 chore: flatten jest_rust directory by removing nested jisspam subdirectory
Remove the intermediate jisspam subdirectory within jest_rust, moving Cargo.lock, .gitignore, and test_files (spam1.txt, spam2.txt, spam3.txt, not_spam.txt) up one level. Update Makefile build_jest target to compile directly from jest_rust instead of jest_rust/jisspam and copy binary to parent directory.
2025-03-24 00:23:38 +00:00
Jest Dotty d1630e5a9c feat: add jest_rust jisspam spam detector with build target and benchmark integration
Add new Rust-based spam detection project under jest_rust/jisspam with Cargo.toml, main.rs implementing forbidden word analysis, and test files for spam/not-spam classification. Include build_jest target in Makefile, add jisspam binary to .gitignore, and integrate its execution into bench.py benchmark suite alongside existing C, CPP, and Python implementations.
2025-03-24 00:03:09 +00:00
BordedDev dee74d4ddb fix: remove TBB library link from borded C++ build target in Makefile
The `-ltbb` flag was removed from the `build_borded_cpp` target's g++ command
in the Makefile, eliminating the dependency on Intel Threading Building Blocks
for the borded C++ executable compilation.
2025-03-23 22:37:31 +00:00
BordedDev ae2d5a7b9d fix: swap benchmark order to measure Rust after C instead of before 2025-03-23 21:40:43 +00:00
BordedDev b3f6056e9c chore: reorder benchmark execution order and add TBB-linked main3.cpp variant
- Swapped benchmark order in bench.py to run Rust before C for consistent measurement
- Added new main3.cpp source with parallel TBB-based implementation using async I/O and CRC32
- Updated Makefile to link borded_cpp_exec against libtbb and compile from main3.cpp
- Modified CMakeLists.txt to add main3.cpp target with TBB linkage and disable -Werror
2025-03-23 21:06:48 +00:00
BordedDev 4729cb0a7a feat: add main2.cpp without struct and refactor check_word to exact match
Replace substring-based bad word detection with exact match in check_word, and create main2.cpp as a variant that removes the AnalysisResult struct entirely while preserving all other logic.
2025-03-23 02:36:29 +00:00
retoor 219650f4f1 feat: add build_py target and benchmark for Python isspam implementation
Add a new Makefile target to copy the Python isspam script into the project root, and extend the benchmark script to measure execution time for the Python version alongside existing C and C++ implementations.
2025-03-23 02:25:51 +00:00
BordedDev 49a2136030 fix: replace std::vector with constexpr std::array for BAD_WORDS and add utf8-aware print fallback in main.cpp 2025-03-23 01:13:38 +00:00
retoor 2848d1b80c feat: add python-based spam detection script with file analysis and forbidden word checking
Implement a new Python script `isspam.py` that analyzes text files for spam indicators by counting total words, capitalized words, sentences, numbers, and occurrences of a predefined list of 40 forbidden words. The script supports multi-file input via command-line arguments, reads files in 1024-byte chunks, and uses threading for concurrent analysis.
2025-03-22 22:55:48 +00:00
BordedDev ed54602bf4 feat: add borded_cpp benchmark target and switch Dockerfile to gcc
Add borded_cpp_exec to .gitignore, include build_borded_cpp in Makefile all target, and extend bench.py with Borded CPP timing. Change borded_cpp Dockerfile base from alpine to gcc:latest with apt-based dependencies.
2025-03-20 22:32:24 +00:00
BordedDev 1dfc4a495d feat: add build target for borded_cpp and lower cmake minimum version to 3.25
Add a new `build_borded_cpp` make target that compiles the borded_cpp
version of isspam using C++23 with `-Ofast` optimization. Also reduce
the CMake minimum required version from 3.30 to 3.25 in the borded_cpp
CMakeLists.txt to improve compatibility with older CMake installations.
2025-03-20 22:21:33 +00:00
retoor e17945027b feat: add Dockerfile, compose.yml, and doit.sh for C++ build environment
Introduce a Docker-based development setup for the borded_cpp project. The Dockerfile uses Alpine Linux with build-base, SQLite, Jansson, and CMake. The compose.yml mounts the project directory and a shared books volume, runs doit.sh which cleans, configures, and builds the project via CMake.
2025-03-20 21:52:53 +00:00
retoor be7dda9daf fix: replace C++23 modules and print with C++17 headers and iostream in borded_cpp
Replace the `import std;` module directive with explicit C++17 standard library includes
and substitute `std::println` calls with `std::cout` equivalents to ensure compatibility
with older compiler toolchains. Also add an overloaded `operator<<` for `AnalysisResult`
to enable formatted output via iostream, and convert `std::wifstream::open` to accept a
`std::string` instead of `std::string_view` for broader C++17 support.
2025-03-20 21:23:41 +00:00
BordedDev 67640f034f feat: add initial C++ project structure with CMake build and spam word parser
Implement the first version of the borded spam parser as a C++26 project. The commit introduces a complete project skeleton including a `.gitignore` file for CMake and IDE artifacts, a `CMakeLists.txt` with strict warning flags and MSVC compatibility, and the core `src/main.cpp` containing the spam detection logic. The parser reads text files, tokenizes words, counts sentences and capitalized words, and flags occurrences from a predefined list of 35 forbidden spam-related terms (e.g., "crypto", "bitcoin", "recovery", "hack"). Results are aggregated via an `AnalysisResult` struct with a custom `operator+` for combining multiple file analyses.
2025-03-20 20:44:22 +00:00
retoor 3aa6ac2451 chore: delete all isspam_v1 through v4 Rust spam analysis files 2025-03-20 14:40:04 +00:00
retoor ca42ad8abc feat: add C++ port of isspam with updated tokenizer and benchmark integration
Add a new C++ implementation of the isspam text analysis tool in retoor_c/isspam.cpp, mirroring the C version's functionality with thread-based file analysis. Update the Makefile with a build_cpp target and add the new binary to .gitignore. Modify bench.py to include timing for the C++ executable. Fix the C tokenizer's delimiter string from punctuation-only to include all standard whitespace characters (\f\v\r\n\t).
2025-03-20 14:27:02 +00:00
retoor 4b44ad85ec chore: add .r_history to gitignore and strip strict compiler flags from Makefile 2025-03-20 00:18:41 +00:00
retoor d4867f571e fix: add explicit exit(0) call before return in isspam.c main function 2025-03-19 20:07:22 +00:00
retoor 0d6afe12f2 chore: add target, isspam, and risspam entries to .gitignore 2024-12-04 22:39:05 +00:00
retoor 6042864d56 chore: remove entire target directory with compiled artifacts and cached metadata 2024-12-04 22:38:26 +00:00
retoor f3a93b6cbc feat: replace forked child processes with pthreads for concurrent file analysis in main
Replace the fork-based parallel execution in main() with POSIX threads, adding a new analyze_file_thread wrapper function. The change removes per-file printf output and eliminates the separate child process for each argument, instead creating a thread per file, joining all threads, and freeing the allocated thread array. This improves resource sharing and avoids process overhead for concurrent file analysis.
2024-12-04 22:10:45 +00:00
retoor 79965cfbb1 fix: suppress command echoing in publish target by prefixing with @ 2024-12-02 14:30:51 +00:00
retoor 03fafdf101 fix: correct typo in wget flag for publish download command
The diff shows a single character change in the Makefile's publish target, where the wget command for downloading the publish script had a space between the double dash and the quiet flag (`-- quiet`), which has been corrected to the proper format (`--quiet`). This fix ensures the wget command executes correctly without flag parsing errors.
2024-12-02 14:30:10 +00:00
retoor 7a7c28543b chore: update build trigger timestamp and add quiet flag to wget in Makefile
- Bump .build-trigger timestamp from 2014-12-02 15:22 to 15:26 to force rebuild
- Add --quiet flag to both wget calls in publish target to suppress download progress output
2024-12-02 14:27:08 +00:00
retoor fb71c4a7b6 chore: add .build-trigger-2014-12-02 15:22 marker to .gitignore for build automation 2024-12-02 14:22:52 +00:00
retoor 6f6e78940e chore: suppress command echoing in benchmark target by adding @ prefix to all commands 2024-12-02 14:16:31 +00:00
retoor eec8569e08 chore: remove redundant cargo env source and reorder build steps in CI workflow
- Remove duplicate `source $HOME/.cargo/env && make` step that was redundant with later build commands
- Move cargo environment sourcing to `build_risspam` step where it is actually needed for compilation
- Keep `make build` and `make run` steps without explicit cargo env to rely on default PATH setup
2024-12-02 14:13:03 +00:00
retoor 3de0edd36a chore: add __pycache__ to .gitignore and remove tracked pyc file
The __pycache__ directory was being tracked by git, causing compiled Python bytecode files like env.cpython-312.pyc to appear in the repository. This change adds __pycache__ to .gitignore and removes the existing pyc file from version control.
2024-12-02 14:10:58 +00:00
retoor b27cc00f58 chore: add build, run, benchmark and publish steps to CI workflow and introduce isspam_v4 spam analysis module 2024-12-02 14:10:18 +00:00
retoor 05998da4a0 chore: update compiled risspam binary in 12bitfloat_rust and root directories 2024-12-01 22:24:22 +00:00
retoor 524ef8343c feat: refactor sentence and word analysis to use counts instead of collections
Rewrite `get_sentences` to return a `usize` count instead of `Vec<&str>`, removing the trailing-dot cleanup logic. Replace `get_words` and `get_capitalized_words` with a single `get_words` function that mutates output counters for total words, capitalized words, and forbidden words, iterating directly over the content. Add release profile optimizations with thin LTO and abort-on-panic in Cargo.toml.
2024-12-01 22:23:32 +00:00
retoor 6ce4c8b9cd feat: add forking per-file processing in C version and enable parallel flag in Rust benchmark
Add fork() call in retoor_c/isspam.c main loop to spawn child process for each input file, allowing parallel analysis. Update bench.py to pass -p flag to Rust binary risspam for enabling parallel execution mode. Rebuild isspam binary to reflect the C source changes.
2024-12-01 21:32:23 +00:00
retoor a5fb2b9c3c chore: add books directory to gitignore and commit crossbeam fingerprint artifacts
Add 'books' to .gitignore to exclude it from version control, and include generated Rust build fingerprint files for crossbeam-deque, crossbeam-epoch, crossbeam-utils, either, and rayon dependencies under 12bitfloat_rust/risspam/target/release/.fingerprint/
2024-12-01 21:03:07 +00:00
retoor ef3c9b5c5b feat: add benchmark target to Makefile and optimize isspam.c with stricmp
- Add 'benchmark' target to Makefile that extracts books archive and runs bench.py
- Reorder includes in isspam.c (rstr.h before rstring_list.h)
- Replace file_exists() with case-insensitive stricmp() for forbidden word matching
- Remove unused flags (show_capitalized, show_sentences, etc.) and stripws() function
- Add memory usage comment and fix trailing newline in rstr.h header guard
2024-12-01 21:02:32 +00:00
retoor 8b7f05b129 refactor: remove redundant sentence splitting and word extraction in isspam analysis functions
Refactor `get_capitalized_words` and `get_forbidden_words` to accept pre-extracted word lists instead of raw content strings, eliminating duplicate calls to `get_words` and `get_sentences`. Move word extraction into the caller `analyze` to compute word count once and reuse the list across all analysis steps, reducing memory allocations and freeing overhead.
2024-12-01 18:40:01 +00:00
retoor 074a5f8779 chore: bump Cargo.lock format to v4 and add rayon dependency for risspam
- Update Cargo.lock version from 3 to 4
- Add rayon 1.10.0 with core, crossbeam-deque, crossbeam-epoch, crossbeam-utils, and either dependencies
- Register rayon as a dependency in the risspam package
- Update compiled release binary for risspam and top-level risspam binary
2024-11-30 22:48:02 +00:00
retoor 08c9e97298 feat: add rayon parallel processing and refactor get_numbers to accept clean_content slice
- Add rayon dependency to Cargo.toml and import parallel prelude in both isspam_v3.rs and risspam/src/main.rs
- Change get_numbers signature to take &str instead of &str and return Vec<&str> instead of Vec<String>, removing unnecessary allocation
- Guard word_count_per_sentence calculation against empty sentences list to prevent division by zero
- Enable file reading from command-line arguments in isspam_v1.rs by uncommenting and fixing the arg loop with skip(1)
- Remove embedded SPAM1 static test data from isspam_v1.rs and create new isspam_v2.rs with additional analysis functions
2024-11-30 22:46:08 +00:00
retoor 9a67649df6 docs: add blank lines between sections and fix Valgrind status formatting in README
Improve readability of the README by inserting blank lines between major sections
and reformatting the Valgrind status paragraph to separate the Rust variant comment
from the date line, ensuring consistent markdown structure throughout the document.
2024-11-30 21:13:27 +00:00
retoor 5100a36421 fix: move cargo env sourcing into make step and fix build echo target name 2024-11-30 21:11:41 +00:00
retoor 6fb8e59311 docs: add version overview and clarify build/run instructions in readme
- Document that repository contains both Rust (risspam) and C (isspam) implementations
- Update build and run examples to distinguish between the two versions
- Clarify stdin usage works only for isspam and valgrind status applies to isspam only
2024-11-30 21:08:28 +00:00
retoor e7725601b2 feat: move source files into retoor_c directory and add build echo messages
- Add echo messages for both build targets to indicate which project is being compiled
- Update isspam.c path to reflect new retoor_c/ subdirectory structure
- Keep binary output location unchanged at project root
2024-11-30 21:05:06 +00:00
retoor 17ff82c199 feat: add compressed archive of book files to repository
The archive books.tar.gz has been added, containing the initial set of book data files for the project.
2024-11-30 20:39:14 +00:00
retoor 04c1cf45cb fix: correct cargo environment source path in CI workflow
The CI workflow was sourcing the cargo binary directory ($HOME/.cargo/bin) instead of the environment setup script ($HOME/.cargo/env), which prevented proper initialization of Rust toolchain paths during build steps.
2024-11-30 20:32:18 +00:00
retoor d053dac468 fix: source cargo bin before checkout in build workflow to fix PATH 2024-11-30 20:30:48 +00:00
retoor bab72cd97e fix: source cargo environment before running make in build workflow 2024-11-30 20:28:30 +00:00
retoor ca71cc5177 ci: remove --profile minimal flag from rustup install in build workflow 2024-11-30 20:25:18 +00:00
retoor 9967ea9a6c feat: add rust toolchain installation and build step for risspam in CI
Add curl to apt install list and install Rust nightly via rustup in the CI workflow. Update Makefile all target to include build_risspam before run_risspam, ensuring the Rust-based risspam binary is compiled before execution.
2024-11-30 20:10:24 +00:00
retoor 857be54db5 chore: remove valgrind target from build workflow and simplify CI step 2024-11-30 20:04:32 +00:00
retoor 3e1d5e3619 fix: correct target name from rispam to risspam in Makefile all and run_risspam dependencies 2024-11-30 20:04:01 +00:00
retoor e9adda3804 chore: move risspam binary to new location in repository structure 2024-11-30 19:59:27 +00:00
retoor c6311b10fe feat: add initial Rust spam detection module with isspam and risspam variants
Implement core spam analysis functions including content cleaning, sentence splitting, capitalized word detection, and forbidden word filtering across three Rust source files with nightly let_chains feature
2024-11-30 19:58:19 +00:00
retoor 79e2dc4819 feat: add rust implementation with build and run targets in Makefile
Add build_risspam target that compiles the Rust risspam binary from
12bitfloat_rust/risspam using cargo run --release, and add run_risspam
target with spam and not_spam test execution via run_spam_risspam and
run_not_spam_risspam recipes.
2024-11-30 19:58:00 +00:00
retoor c8abc02688 fix: update valgrind status date to 2024-11-30 with refreshed heap summary 2024-11-30 19:34:39 +00:00
retoor b607207647 feat: add per-file analysis counter and percentage outputs to isspam, plus totals.py summarizer
Introduce a global `total` counter incremented on each `analyze()` call, printing the file sequence number. Extend the analysis block to compute and display capitalized and forbidden word percentages when forbidden words exist. Add a new Python script `totals.py` that reads the application output and computes average percentages across all processed files.
2024-11-30 19:32:55 +00:00
retoor 48e59e2bd8 fix: prevent division by zero in word count per sentence calculation
The commit updates the README example output to reflect a spam file analysis with
detailed forbidden word breakdown and increased memory usage. It also fixes a
potential division by zero in `analyze()` by guarding `sentences->count` with a
ternary operator that defaults to 1 when zero, ensuring stable output for edge
cases. The binary `isspam` is rebuilt to include this fix.
2024-11-29 06:54:49 +00:00
retoor baa1ffe9c2 fix: change word_count_per_sentence type from uint to ulonglong in analyze function to prevent overflow on large text inputs 2024-11-29 06:25:09 +00:00
retoor 0582fd8667 fix: migrate loop counters and count fields from unsigned int to unsigned long long across isspam.c and rstring_list.h 2024-11-29 06:24:30 +00:00
retoor 284544880d fix: remove locale-specific formatting and increase stats buffer size
- Remove the apostrophe flag from sprintf format specifier in rmalloc_lld_format to avoid locale-dependent thousands separator, which caused unexpected commas in output
- Increase static buffer size in rmalloc_stats from 200 to 300 bytes to prevent potential buffer overflow when formatting memory statistics with larger values
2024-11-29 05:49:48 +00:00
retoor 9ed1c43bc0 feat: add conditional display flags and file_exists helper to isspam.c
Introduce four boolean flags (show_capitalized, show_sentences, show_words, show_numbers) that control whether their respective analysis results are printed via sld(), replacing the previously commented-out calls. Add a file_exists() utility function that checks if a given path points to an existing readable file. Also append "publish" to .gitignore.
2024-11-29 05:45:06 +00:00
retoor a9d1c175fe docs: add valgrind build instructions to README for memory checking
Add a new code block in the README under the "Build" section showing how to run the build with valgrind for memory checking. The block includes a comment that valgrind must be installed and shows the `make valgrind` command. This helps developers easily find and use the memory check build target.
2024-11-28 18:05:34 +00:00
retoor 00760067b8 docs: add example output section to README with sample isspam run
Add a new "Example output" section to the README that demonstrates the expected output format when running the isspam tool on a non-spam file, including metrics for capitalized words, sentences, word counts, and memory usage statistics.
2024-11-28 18:04:06 +00:00
retoor 46594bf5a3 docs: add README with build, run, and valgrind usage instructions for isspam project 2024-11-28 18:02:57 +00:00
retoor 22911a7c8b fix: correct typographical errors and ensure consistent spelling across documentation 2024-11-28 17:41:36 +00:00
retoor bbe721b620 feat: add initial project structure with spam detection tool and supporting libraries
Add the complete source tree for the isspam spam detection utility, including the main C implementation (isspam.c), custom memory allocator (rmalloc.h), string builder (rstr.h), dynamic string list (rstring_list.h), build configuration (Makefile, .clang-format), CI workflow (.gitea/workflows/build.yaml), and sample test data (spam/examole_spam3.txt, not_spam/correct1.txt). The core logic defines a list of forbidden words and provides functions for tokenizing input, removing preserved characters, and checking content against the spam keyword set.
2024-11-28 17:39:34 +00:00

Diff Content Not Available