Skip to content

vers. 3.2.0

Choose a tag to compare

@komed3 komed3 released this 22 Jan 13:15
· 269 commits to master since this release
6929b12

This release focuses on a comprehensive internal overhaul with a strong emphasis on performance, correctness, and long-term maintainability. While the public API changes are deliberately minimal, large parts of the internal architecture were refined, resulting in faster execution, improved caching behavior, better memory safety, and more predictable results across synchronous and asynchronous workflows.


What’s New

Public API:

  • Added Filter.has() to check for the existence of registered filters per hook
  • Introduced unified return type aliases for comparison operations:
    • ResultLike, BatchResultLike
    • StructuredResultLike
  • Renamed TextAnalyzer.getUnicodeStats() to TextAnalyzer.getUnicodeCodepoints()
  • Added new TextAnalyzer metrics:
    • getAvgSyllablesPerWord()
    • getMedianSyllablesPerWord()

Root / Advanced Access:

  • Exposed Hasher.fastFNV1a() for high-performance hashing use cases

Changes & Fixes

Performance & Memory:

  • Eliminated potential memory leaks by guarding pool allocations with try / finally
  • Replaced Uint16Array with Int32Array to correctly handle negative values
  • Improved performance through static RegExp construction
  • Optimized score-based metrics (Needleman–Wunsch, Smith–Waterman) using Int32Array
  • Reduced local allocations in hash generators for faster execution
  • Added optional LRU support to hash tables and fixed overflow detection
  • Replaced modulo operations with bit masking for pool pointer arithmetic

Caching & Correctness:

  • Fixed incorrect cache hits for metrics and phonetic algorithms with differing options
  • Added missing cache layer in async phonetic index computation
  • Performed input swapping (shorter string first) for symmetric metrics before cache lookup
  • Fixed incorrect handling of the phonetic middle rule
  • Normalizer now uses canonicalized flags to improve cache efficiency

Internal Architecture:

  • Filters now use per-hook Map instances for faster lookup
  • Filters precompute execution pipelines per hook to reduce runtime overhead
  • DeepMerge utility optimized via linear traversal and path caching
  • Pool implementation fixed pointer positioning and improved utilization
  • Profiler now selects predefined timing and memory functions based on the detected runtime environment
  • Registry and profiler services are now frozen via Object.freeze()

TextAnalyzer Improvements:

  • Significant performance gains through caching
  • Improved handling of special characters and Unicode edge cases

Type System & Documentation:

  • Refined TypeScript types across the codebase
  • Updated inline documentation to reflect the new internal structure

Tooling, CI & Project Maintenance

  • Full codebase refactor (+2,600 / -2,400 lines changed)
  • Performance-focused pull request: vers. 3.2 / performance enhancement
  • All CI checks and internal test suites passed
  • TypeScript configuration migrated to NodeNext
  • Expanded and improved linting rules
  • Development dependencies updated to their latest versions
  • Test coverage expanded to 70 tests, including edge cases
  • Added dedicated stress test suite
  • Documentation updates:
    • Revised README.md
    • Added SECURITY.md
    • Added CONTRIBUTING.md

CmpStr v3.2.0 is a performance- and quality-driven release that strengthens the foundation of the library while keeping the public API stable. It prepares the project for future feature work without compromising determinism or reliability.

Full Changelog: v3.1.1...v3.2.0