Skip to content

v1.2.2

Choose a tag to compare

@umputun umputun released this 11 Aug 22:04
· 1 commit to master since this release
ea95ec0

Hotfix Release: Unified DeDup Implementation

Breaking Changes (Improvements)

  • DeDup now stable: The DeDup function now preserves the order of first occurrences, making it predictable and consistent
  • No input mutation: DeDup no longer modifies the input slice, returning a new slice instead

Performance Improvements

  • DeDup improved from O(n²) to O(n) time complexity for all slice sizes
  • Significant performance boost for small to medium slices
  • No performance degradation for large slices

Changes

  • Unified DeDup and DeDupBig to use the same stable, map-based algorithm
  • DeDupBig is now deprecated (but maintained for backwards compatibility)
  • Added comprehensive test coverage reaching 98.8%
  • Fixed unsafe byte-to-string conversion
  • Optimized HasCommonElement from O(n*m) to O(n+m)
  • Fixed edge case handling in ContainsAnySubstring

Migration Guide

  • If your code relies on DeDup mutating the input slice, update to: slice = DeDup(slice)
  • DeDupBig users can continue using it or switch to DeDup (both now identical)
  • The stable ordering is a positive change that should not break well-written code

Technical Details

The previous DeDup used an unstable O(n²) algorithm that mutated input slices. The new implementation uses a map-based approach that is stable, faster, and safer. This change was validated by multiple code analysis tools and comprehensive testing.