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

perf(utils): optimize slice functions #132

Merged
merged 2 commits into from
Aug 25, 2024
Merged

Conversation

nuxencs
Copy link
Owner

@nuxencs nuxencs commented Aug 24, 2024

Optimizing runtime, and memory usage for the utility functions for slices.

  • EqualElements now uses a frequency map to avoid having to sort the slices to compare and is now generic
  • DedupeSlice now uses a string to empty struct map, that way we don't need to check for the bool values anymore and have the advantage that the empty struct doesn't take up any memory
  • SimplifyHDRSlice removed the if check for zero-length slices as go already handles that

@nuxencs nuxencs added Area: Utilities Related to the utilities Type: Refactor Refactoring of code Area: Testing Related to the testing labels Aug 24, 2024
@nuxencs nuxencs added this to the v0.9.1 milestone Aug 24, 2024
Copy link

@zze0s zze0s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since it looks to be working as intended 👍

However, a lot of these can be replaced with built in functions that was already partially used.

That way you don't need your own tests to make sure they work as intended.

@nuxencs nuxencs force-pushed the perf/optimize-slice-utils branch from 979beb4 to 949df72 Compare August 25, 2024 14:02
@nuxencs nuxencs merged commit 7a3aa64 into develop Aug 25, 2024
12 checks passed
@nuxencs nuxencs deleted the perf/optimize-slice-utils branch August 25, 2024 16:00
nuxencs added a commit that referenced this pull request Aug 31, 2024
* perf(utils): optimize slice functions

* test(utils): added tests for SimplifyHDRSlice
nuxencs added a commit that referenced this pull request Sep 4, 2024
* feat(notifications): filter notifications

* fix(notifications): default slice not overwriting correctly

* chore(logging): move notification skip logging to debug level

* refactor: receivers and var names (#131)

* perf(utils): optimize slice functions (#132)

* perf(utils): optimize slice functions

* test(utils): added tests for SimplifyHDRSlice

* refactor(notifications): map notification level to status codes

* fix(config): workaround for viper not overwriting slice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Testing Related to the testing Area: Utilities Related to the utilities Type: Refactor Refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants