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

Add funcs for non-immutables w/o copying #75

Merged
merged 8 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,6 @@ ENV/

# macOS
.DS_Store

# vscode
.vscode/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project has adhered to

### Added

- Add `digest` functions that accept a non-immutable buffer as input
and process it without internal copying.
- Slightly improve the performance of the `hash_bytes` function.
- Add support for Python 3.13.
- Add Read the Docs documentation (<https://github.com/hajimes/mmh3/issues/54>).
Expand All @@ -21,6 +23,10 @@ This project has adhered to
- Change the format of CHANGELOG.md to conform to the Keep a Changelog
standard.

### Fixed

- Fix a reference leak in the `hash_from_buffer()` function.

## [4.1.0] - 2024-01-09

### Added
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,23 @@ complete changelog.

#### Added

- Add `digest` functions that accept a non-immutable buffer as input
and process it without internal copying.
- Slightly improve the performance of the `hash_bytes` function.
- Add support for Python 3.13.
- Add Read the Docs documentation (<https://github.com/hajimes/mmh3/issues/54>).
- (planned: Document benchmark results
(<https://github.com/hajimes/mmh3/issues/53>)).

#### Changed
### Changed

- Change the format of CHANGELOG.md to conform to the Keep a Changelog
standard.

### Fixed

- Fix a reference leak in the `hash_from_buffer()` function.

### [4.1.0] - 2024-01-09

#### Added
Expand Down
4 changes: 2 additions & 2 deletions benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
MASK: Final[int] = 0xFFFFFFFFFFFFFFFF

HASHES = {
"mmh3_32": mmh3.hash,
"mmh3_128": mmh3.hash_bytes,
"mmh3_32": mmh3.mmh3_32_digest,
"mmh3_128": mmh3.mmh3_x64_128_digest,
"xxh_32": xxhash.xxh32_digest,
"xxh_64": xxhash.xxh64_digest,
"xxh3_64": xxhash.xxh3_64_digest,
Expand Down
3 changes: 3 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
API Reference
================

.. caution::
This reference contains functions that are not yet released in the stable version.

.. automodule:: mmh3
:members:
:undoc-members:
Expand Down
21 changes: 19 additions & 2 deletions src/mmh3/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,26 @@ StrHashable = Union[str, Hashable]

def hash(key: StrHashable, seed: int = 0, signed: bool = True) -> int: ...
def hash_from_buffer(key: StrHashable, seed: int = 0, signed: bool = True) -> int: ...
def hash64(key: StrHashable, seed: int = 0, x64arch:bool = True, signed: bool = True) -> tuple[int, int]: ...
def hash128(key: StrHashable, seed: int = 0, x64arch:bool = True, signed: bool = False) -> int: ...
def hash64(
key: StrHashable, seed: int = 0, x64arch: bool = True, signed: bool = True
) -> tuple[int, int]: ...
def hash128(
key: StrHashable, seed: int = 0, x64arch: bool = True, signed: bool = False
) -> int: ...
def hash_bytes(key: StrHashable, seed: int = 0, x64arch: bool = True) -> bytes: ...
def mmh3_32_digest(key: StrHashable, seed: int = 0) -> bytes: ...
def mmh3_32_sintdigest(key: StrHashable, seed: int = 0) -> int: ...
def mmh3_32_uintdigest(key: StrHashable, seed: int = 0) -> int: ...
def mmh3_x64_128_digest(key: StrHashable, seed: int = 0) -> bytes: ...
def mmh3_x64_128_sintdigest(key: StrHashable, seed: int = 0) -> int: ...
def mmh3_x64_128_uintdigest(key: StrHashable, seed: int = 0) -> int: ...
def mmh3_x64_128_stupledigest(key: StrHashable, seed: int = 0) -> tuple[int, int]: ...
def mmh3_x64_128_utupledigest(key: StrHashable, seed: int = 0) -> tuple[int, int]: ...
def mmh3_x86_128_digest(key: StrHashable, seed: int = 0) -> bytes: ...
def mmh3_x86_128_sintdigest(key: StrHashable, seed: int = 0) -> int: ...
def mmh3_x86_128_uintdigest(key: StrHashable, seed: int = 0) -> int: ...
def mmh3_x86_128_stupledigest(key: StrHashable, seed: int = 0) -> tuple[int, int]: ...
def mmh3_x86_128_utupledigest(key: StrHashable, seed: int = 0) -> tuple[int, int]: ...

class Hasher:
def __init__(self, seed: int = 0) -> None: ...
Expand Down
Loading
Loading