Skip to content

v0.4.1 - Performance optimizations

Choose a tag to compare

@Zheruel Zheruel released this 03 Sep 20:21
· 58 commits to main since this release

Performance Improvements

This release focuses on algorithmic performance optimizations across 7 string utility functions.

Optimized Functions

  • hashString: Replaced with FNV-1a implementation for better distribution
  • levenshtein: Added prefix/suffix trimming optimization
  • deburr: Consolidated 14+ regex operations into single pattern
  • fuzzyMatch: Progressive threshold checking and short-circuit evaluation
  • toASCII: Replaced 155+ regex operations with single-pass Map lookup
  • normalizeWhitespace: Pre-compiled patterns and single-pass regex
  • removeNonPrintable: Replaced 4 regex passes with range comparisons

Impact

  • Significant performance improvements for strings with many replaceable characters
  • Reduced complexity from O(n*m) to O(n) in several cases
  • Bundle size remains under 6KB limit (5.13 kB ESM / 5.48 kB CJS)
  • All optimizations maintain backward compatibility
  • Zero dependencies maintained

Full Changelog: v0.4.0...v0.4.1