Skip to content

v0.5.1 - Regex Performance Optimization

Choose a tag to compare

@Zheruel Zheruel released this 04 Sep 16:17
· 54 commits to main since this release
356396b

🚀 Performance Improvements

This release focuses on optimizing regex patterns across the entire codebase for significant performance improvements.

✨ What's Changed

Performance Optimizations

  • Pre-compiled all static regex patterns across 21 functions for 2-3x performance improvement
  • Case Conversion (8 functions): camelCase, pascalCase, kebabCase, snakeCase, constantCase, dotCase, pathCase - pre-compiled 5-7 patterns each
  • HTML Processing (4 functions): escapeHtml, stripHtml, highlight - optimized regex and lookup tables
  • Text Processing (6 functions): sentenceCase (10 patterns), titleCase (4 patterns), fuzzyMatch, slugify, pluralize, deburr
  • Utilities (3 functions): wordCount, isEmail, excerpt - eliminated regex recreation overhead
  • Combined sequential replacements in highlight function for single-pass HTML escaping

📊 Results

  • ✅ All 822 tests pass with 97.72% coverage
  • ✅ Bundle size maintained under 6KB (5.64 kB ESM, 5.97 kB CJS)
  • ✅ No breaking changes - same API preserved

📦 Installation

npm install [email protected]

Full Changelog: v0.5.0...v0.5.1