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

mash: optimize mash similarity function, add benchmark #395

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

matiasinsaurralde
Copy link
Contributor

@matiasinsaurralde matiasinsaurralde commented Nov 5, 2023

Changes in this PR

  • Optimizes the mash similarity function: removed sort.Search usage, merged the early exit conditions and rewrote the sketch traversing logic.
  • Adds simple mash.Distance benchmark.

Why are you making these changes?

  • General optimization:
% benchcmp old.txt new.txt 
benchmark           old ns/op     new ns/op     delta
BenchmarkMash-8     118           9.71          -91.75%
BenchmarkMash-8     113           9.72          -91.43%
BenchmarkMash-8     113           9.71          -91.43%

benchmark           old allocs     new allocs     delta
BenchmarkMash-8     0              0              +0.00%
BenchmarkMash-8     0              0              +0.00%
BenchmarkMash-8     0              0              +0.00%

benchmark           old bytes     new bytes     delta
BenchmarkMash-8     0             0             +0.00%
BenchmarkMash-8     0             0             +0.00%
BenchmarkMash-8     0             0             +0.00%

Are any changes breaking? (IMPORTANT)

No - tests look fine

Pre-merge checklist

All of these must be satisfied before this PR is considered
ready for merging. Mergeable PRs will be prioritized for review.

  • New packages/exported functions have docstrings.
  • New/changed functionality is thoroughly tested.
  • New/changed functionality has a function giving an example of its usage in the associated test file. See primers/primers_test.go for what this might look like.
  • Changes are documented in CHANGELOG.md in the [Unreleased] section.
  • All code is properly formatted and linted.
  • The PR template is filled out.

@TimothyStiles TimothyStiles merged commit 58f8699 into bebop:main Nov 6, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants