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

Array api #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

RandomNameUser
Copy link

Added cleaner APIs for array handling (find first, best, all matches)
Added GIL release for array ops
Added docs for array ops to Readme
Added tests for array ops
Added explicit hamming_distance_byte to have the same interface as hamming_distance_string. Functionally the find first array op does the same thing, but this being Python I'm weary of having two apparently interchangeable functions that have different return types, that just smells like trouble. ;)

It all seems to work fine, as far as I can tell. The only thing I don't understand is the benchmarking: the best and all array ops are about 2 orders of magnitude faster than the first one. Either the compiler does very high-level optimization magic, or something is wrong that I can't see...

Thanks!

RandomNameUser and others added 3 commits February 10, 2023 16:19
Added GIL release for array functions
Added check_bytes_within_dist to mirror check_hexstrings_within_dist
Fixed 4 space/8 space tab problems
Copy link
Owner

@mrecachinas mrecachinas left a comment

Choose a reason for hiding this comment

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

This looks fine. I only noted two changes before we'll want to merge. I'm not certain off-hand why you're observing that benchmark behavior, but I'd have to look further into it.

I'm comfortable merging and cutting a release after you make those changes if it suits your needs. 👍

@@ -1 +1 @@
const char _version[] = "2.2.3";
const char _version[] = "2.2.3.1";
Copy link
Owner

Choose a reason for hiding this comment

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

Since this is adding to the API, let's bump at a minimum the minor version.

Suggested change
const char _version[] = "2.2.3.1";
const char _version[] = "2.3.0";

@@ -172,7 +172,7 @@ static PyObject * hamming_distance_byte_wrapper(PyObject *self, PyObject *args)
* @param args Python arguments for `check_hexstrings_within_dist` interface
* - `string1` -- hex string
* - `string2` -- hex string
* @returns
* @returns True if the hamming distance is less or equal to max_dist, False otherwise.
Copy link
Owner

Choose a reason for hiding this comment

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

I think the spacing rendered as tabs, so just changing it to spaces here to stay in-line with the other docs.

Suggested change
* @returns True if the hamming distance is less or equal to max_dist, False otherwise.
* @returns True if the hamming distance is less or equal to max_dist, False otherwise.

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