Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use KMeans++ For ColorScape Generation #3164

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Commits on Sep 10, 2024

  1. Optimized Normalize function with caching for 13x performance improve…

    …ment
    
    - Implemented caching using ConcurrentDictionary to store normalized results
    - Added cache lookup before normalization to improve performance on repeated calls
    - Changed ToLower() to ToLowerInvariant() for culture-insensitive lowercase conversion
    - Removed unnecessary string.Empty parameter in Trim() call
    
    Performance improvements:
    - Mean execution time reduced from 231.819 μs to 16.711 μs
    - Memory allocation reduced from 65019 B to 32 B
    - GC pressure eliminated (Gen0 collections reduced from 20.5078 to 0)
    - Passed Unit Tests
    F0x1 committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    9d52e2c View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2024

  1. Optimize KMeansClustering: ~15.86x faster, 99% less memory allocation

    - Implemented K-means++ for better initial centroid selection
    - Parallelize point assignment to nearest centroids
    - Added early termination when centroids converge
    - Optimized distance calculations using squared distances
    - Created benchmark to compare original and optimized versions
    Benchmark results:
    - Execution time: 3.58 ms (down from 56.85 ms, 15.86x faster)
    - Memory allocation: 532.07 KB (down from 97,486.85 KB, 99% reduction)
    - GC Gen0 collections: 175.7 (down from 31777.7, 99% reduction)
    
    Test Cases showed matching results for the optimized function
    F0x1 committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    7a9f363 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b970301 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2024

  1. Revert "Optimized Normalize function with caching for 13x performance…

    … improvement"
    
    This reverts commit 9d52e2c.
    F0x1 committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    052f42d View commit details
    Browse the repository at this point in the history