gxhash 0.1.2__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gxhash might be problematic. Click here for more details.
- {gxhash-0.1.2/py-gxhash → gxhash-0.1.4}/Cargo.lock +38 -36
- {gxhash-0.1.2/py-gxhash → gxhash-0.1.4}/Cargo.toml +2 -2
- {gxhash-0.1.2 → gxhash-0.1.4}/PKG-INFO +17 -2
- {gxhash-0.1.2/py-gxhash → gxhash-0.1.4}/README.md +14 -0
- {gxhash-0.1.2/py-gxhash → gxhash-0.1.4}/gxhash.pyi +6 -10
- {gxhash-0.1.2 → gxhash-0.1.4}/pyproject.toml +5 -4
- {gxhash-0.1.2/py-gxhash → gxhash-0.1.4}/src/lib.rs +19 -12
- gxhash-0.1.2/.cargo/config.toml +0 -3
- gxhash-0.1.2/.gitattributes +0 -1
- gxhash-0.1.2/.github/workflows/bench.yml +0 -89
- gxhash-0.1.2/.github/workflows/build_test.yml +0 -62
- gxhash-0.1.2/.github/workflows/cross_compile.yml +0 -66
- gxhash-0.1.2/.github/workflows/rust_version.yml +0 -31
- gxhash-0.1.2/.gitignore +0 -25
- gxhash-0.1.2/CITATION.cff +0 -10
- gxhash-0.1.2/Cargo.lock +0 -816
- gxhash-0.1.2/Cargo.toml +0 -69
- gxhash-0.1.2/LICENSE +0 -21
- gxhash-0.1.2/README.md +0 -159
- gxhash-0.1.2/benches/hashset.rs +0 -83
- gxhash-0.1.2/benches/ilp.rs +0 -88
- gxhash-0.1.2/benches/quality/main.rs +0 -498
- gxhash-0.1.2/benches/throughput/aarch64.svg +0 -194
- gxhash-0.1.2/benches/throughput/main.rs +0 -186
- gxhash-0.1.2/benches/throughput/result_processor.rs +0 -184
- gxhash-0.1.2/benches/throughput/x86_64-avx2.svg +0 -174
- gxhash-0.1.2/benches/throughput/x86_64-hybrid.svg +0 -152
- gxhash-0.1.2/benches/throughput/x86_64.svg +0 -152
- gxhash-0.1.2/benches/throughput_criterion.rs +0 -94
- gxhash-0.1.2/build.rs +0 -3
- gxhash-0.1.2/examples/hello_world.rs +0 -13
- gxhash-0.1.2/py-gxhash/gentoo_root.img +0 -0
- gxhash-0.1.2/py-gxhash/main.py +0 -152
- gxhash-0.1.2/py-gxhash/uv.lock +0 -99
- gxhash-0.1.2/rustfmt.toml +0 -2
- gxhash-0.1.2/src/gxhash/mod.rs +0 -226
- gxhash-0.1.2/src/gxhash/platform/arm.rs +0 -162
- gxhash-0.1.2/src/gxhash/platform/mod.rs +0 -48
- gxhash-0.1.2/src/gxhash/platform/x86.rs +0 -198
- gxhash-0.1.2/src/hasher.rs +0 -337
- gxhash-0.1.2/src/lib.rs +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This file is automatically @generated by Cargo.
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
|
-
version =
|
|
3
|
+
version = 3
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "addr2line"
|
|
@@ -25,9 +25,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
|
|
25
25
|
|
|
26
26
|
[[package]]
|
|
27
27
|
name = "backtrace"
|
|
28
|
-
version = "0.3.
|
|
28
|
+
version = "0.3.75"
|
|
29
29
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
-
checksum = "
|
|
30
|
+
checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
|
|
31
31
|
dependencies = [
|
|
32
32
|
"addr2line",
|
|
33
33
|
"cfg-if",
|
|
@@ -142,6 +142,8 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
|
|
142
142
|
[[package]]
|
|
143
143
|
name = "gxhash"
|
|
144
144
|
version = "3.5.0"
|
|
145
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
+
checksum = "f3ce1bab7aa741d4e7042b2aae415b78741f267a98a7271ea226cd5ba6c43d7d"
|
|
145
147
|
dependencies = [
|
|
146
148
|
"rustversion",
|
|
147
149
|
]
|
|
@@ -154,9 +156,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
|
154
156
|
|
|
155
157
|
[[package]]
|
|
156
158
|
name = "indoc"
|
|
157
|
-
version = "2.0.
|
|
159
|
+
version = "2.0.5"
|
|
158
160
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
159
|
-
checksum = "
|
|
161
|
+
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
|
160
162
|
|
|
161
163
|
[[package]]
|
|
162
164
|
name = "libc"
|
|
@@ -190,9 +192,9 @@ dependencies = [
|
|
|
190
192
|
|
|
191
193
|
[[package]]
|
|
192
194
|
name = "miniz_oxide"
|
|
193
|
-
version = "0.8.
|
|
195
|
+
version = "0.8.8"
|
|
194
196
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
195
|
-
checksum = "
|
|
197
|
+
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
|
|
196
198
|
dependencies = [
|
|
197
199
|
"adler2",
|
|
198
200
|
]
|
|
@@ -208,9 +210,9 @@ dependencies = [
|
|
|
208
210
|
|
|
209
211
|
[[package]]
|
|
210
212
|
name = "once_cell"
|
|
211
|
-
version = "1.
|
|
213
|
+
version = "1.20.2"
|
|
212
214
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
-
checksum = "
|
|
215
|
+
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
|
214
216
|
|
|
215
217
|
[[package]]
|
|
216
218
|
name = "pin-project-lite"
|
|
@@ -226,22 +228,22 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
|
|
226
228
|
|
|
227
229
|
[[package]]
|
|
228
230
|
name = "portable-atomic"
|
|
229
|
-
version = "1.
|
|
231
|
+
version = "1.9.0"
|
|
230
232
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
231
|
-
checksum = "
|
|
233
|
+
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
|
232
234
|
|
|
233
235
|
[[package]]
|
|
234
236
|
name = "proc-macro2"
|
|
235
|
-
version = "1.0.
|
|
237
|
+
version = "1.0.89"
|
|
236
238
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
237
|
-
checksum = "
|
|
239
|
+
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
|
|
238
240
|
dependencies = [
|
|
239
241
|
"unicode-ident",
|
|
240
242
|
]
|
|
241
243
|
|
|
242
244
|
[[package]]
|
|
243
245
|
name = "py-gxhash"
|
|
244
|
-
version = "0.1.
|
|
246
|
+
version = "0.1.4"
|
|
245
247
|
dependencies = [
|
|
246
248
|
"gxhash",
|
|
247
249
|
"libc",
|
|
@@ -253,9 +255,9 @@ dependencies = [
|
|
|
253
255
|
|
|
254
256
|
[[package]]
|
|
255
257
|
name = "pyo3"
|
|
256
|
-
version = "0.24.
|
|
258
|
+
version = "0.24.2"
|
|
257
259
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
258
|
-
checksum = "
|
|
260
|
+
checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219"
|
|
259
261
|
dependencies = [
|
|
260
262
|
"cfg-if",
|
|
261
263
|
"indoc",
|
|
@@ -284,9 +286,9 @@ dependencies = [
|
|
|
284
286
|
|
|
285
287
|
[[package]]
|
|
286
288
|
name = "pyo3-build-config"
|
|
287
|
-
version = "0.24.
|
|
289
|
+
version = "0.24.2"
|
|
288
290
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
289
|
-
checksum = "
|
|
291
|
+
checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999"
|
|
290
292
|
dependencies = [
|
|
291
293
|
"once_cell",
|
|
292
294
|
"target-lexicon",
|
|
@@ -294,9 +296,9 @@ dependencies = [
|
|
|
294
296
|
|
|
295
297
|
[[package]]
|
|
296
298
|
name = "pyo3-ffi"
|
|
297
|
-
version = "0.24.
|
|
299
|
+
version = "0.24.2"
|
|
298
300
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
299
|
-
checksum = "
|
|
301
|
+
checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33"
|
|
300
302
|
dependencies = [
|
|
301
303
|
"libc",
|
|
302
304
|
"pyo3-build-config",
|
|
@@ -304,9 +306,9 @@ dependencies = [
|
|
|
304
306
|
|
|
305
307
|
[[package]]
|
|
306
308
|
name = "pyo3-macros"
|
|
307
|
-
version = "0.24.
|
|
309
|
+
version = "0.24.2"
|
|
308
310
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
309
|
-
checksum = "
|
|
311
|
+
checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9"
|
|
310
312
|
dependencies = [
|
|
311
313
|
"proc-macro2",
|
|
312
314
|
"pyo3-macros-backend",
|
|
@@ -316,9 +318,9 @@ dependencies = [
|
|
|
316
318
|
|
|
317
319
|
[[package]]
|
|
318
320
|
name = "pyo3-macros-backend"
|
|
319
|
-
version = "0.24.
|
|
321
|
+
version = "0.24.2"
|
|
320
322
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
321
|
-
checksum = "
|
|
323
|
+
checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a"
|
|
322
324
|
dependencies = [
|
|
323
325
|
"heck",
|
|
324
326
|
"proc-macro2",
|
|
@@ -329,9 +331,9 @@ dependencies = [
|
|
|
329
331
|
|
|
330
332
|
[[package]]
|
|
331
333
|
name = "quote"
|
|
332
|
-
version = "1.0.
|
|
334
|
+
version = "1.0.37"
|
|
333
335
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
334
|
-
checksum = "
|
|
336
|
+
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
|
335
337
|
dependencies = [
|
|
336
338
|
"proc-macro2",
|
|
337
339
|
]
|
|
@@ -344,9 +346,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
|
|
344
346
|
|
|
345
347
|
[[package]]
|
|
346
348
|
name = "rustversion"
|
|
347
|
-
version = "1.0.
|
|
349
|
+
version = "1.0.18"
|
|
348
350
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
349
|
-
checksum = "
|
|
351
|
+
checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"
|
|
350
352
|
|
|
351
353
|
[[package]]
|
|
352
354
|
name = "slab"
|
|
@@ -359,9 +361,9 @@ dependencies = [
|
|
|
359
361
|
|
|
360
362
|
[[package]]
|
|
361
363
|
name = "syn"
|
|
362
|
-
version = "2.0.
|
|
364
|
+
version = "2.0.87"
|
|
363
365
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
364
|
-
checksum = "
|
|
366
|
+
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
|
|
365
367
|
dependencies = [
|
|
366
368
|
"proc-macro2",
|
|
367
369
|
"quote",
|
|
@@ -376,9 +378,9 @@ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
|
376
378
|
|
|
377
379
|
[[package]]
|
|
378
380
|
name = "tokio"
|
|
379
|
-
version = "1.
|
|
381
|
+
version = "1.45.0"
|
|
380
382
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
381
|
-
checksum = "
|
|
383
|
+
checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165"
|
|
382
384
|
dependencies = [
|
|
383
385
|
"backtrace",
|
|
384
386
|
"pin-project-lite",
|
|
@@ -386,15 +388,15 @@ dependencies = [
|
|
|
386
388
|
|
|
387
389
|
[[package]]
|
|
388
390
|
name = "unicode-ident"
|
|
389
|
-
version = "1.0.
|
|
391
|
+
version = "1.0.13"
|
|
390
392
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
391
|
-
checksum = "
|
|
393
|
+
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
|
392
394
|
|
|
393
395
|
[[package]]
|
|
394
396
|
name = "unindent"
|
|
395
|
-
version = "0.2.
|
|
397
|
+
version = "0.2.3"
|
|
396
398
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
397
|
-
checksum = "
|
|
399
|
+
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
|
398
400
|
|
|
399
401
|
[[package]]
|
|
400
402
|
name = "windows-targets"
|
|
@@ -5,7 +5,7 @@ panic = "abort"
|
|
|
5
5
|
|
|
6
6
|
[package]
|
|
7
7
|
name = "py-gxhash"
|
|
8
|
-
version = "0.1.
|
|
8
|
+
version = "0.1.4"
|
|
9
9
|
edition = "2021"
|
|
10
10
|
|
|
11
11
|
[lib]
|
|
@@ -16,6 +16,6 @@ crate-type = ["cdylib"]
|
|
|
16
16
|
pyo3 = "0.24.0"
|
|
17
17
|
pyo3-async-runtimes = { version = "0.24.0", features = ["tokio-runtime"] }
|
|
18
18
|
tokio = "1.44.1"
|
|
19
|
-
gxhash = {
|
|
19
|
+
gxhash = { version = "3.5.0", features = ["hybrid"], default-features = false }
|
|
20
20
|
memmap2 = "0.9.5"
|
|
21
21
|
libc = "0.2.171"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: gxhash
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
License: MIT
|
|
7
8
|
Requires-Python: >=3.7
|
|
8
9
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
9
10
|
|
|
@@ -41,6 +42,20 @@ if __name__ == "__main__":
|
|
|
41
42
|
main()
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
Hashing bytes asynchronously.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from asyncio import run
|
|
49
|
+
from gxhash import GxHash128
|
|
50
|
+
|
|
51
|
+
async def main():
|
|
52
|
+
gxhash = GxHash128(seed=0)
|
|
53
|
+
result = await gxhash.hash_async(b"Hello, world!")
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
run(main())
|
|
57
|
+
```
|
|
58
|
+
|
|
44
59
|
Hashing a file.
|
|
45
60
|
|
|
46
61
|
```python
|
|
@@ -32,6 +32,20 @@ if __name__ == "__main__":
|
|
|
32
32
|
main()
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
Hashing bytes asynchronously.
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from asyncio import run
|
|
39
|
+
from gxhash import GxHash128
|
|
40
|
+
|
|
41
|
+
async def main():
|
|
42
|
+
gxhash = GxHash128(seed=0)
|
|
43
|
+
result = await gxhash.hash_async(b"Hello, world!")
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
run(main())
|
|
47
|
+
```
|
|
48
|
+
|
|
35
49
|
Hashing a file.
|
|
36
50
|
|
|
37
51
|
```python
|
|
@@ -60,11 +60,11 @@ class Hasher(Protocol):
|
|
|
60
60
|
print(f"Hash is {hasher.hash(bytes([42] * 1000))}!")
|
|
61
61
|
```
|
|
62
62
|
"""
|
|
63
|
-
def
|
|
63
|
+
async def hash_async(self, bytes: bytes) -> int:
|
|
64
64
|
"""
|
|
65
65
|
Summary
|
|
66
66
|
-------
|
|
67
|
-
Hashes `bytes` to an `int`
|
|
67
|
+
Hashes `bytes` to an `int` asynchronously.
|
|
68
68
|
This method allows you to perform multiple hashes with true multi-threaded parallelism.
|
|
69
69
|
If called sequentially, this method is slightly less performant than the default `hash` method.
|
|
70
70
|
Otherwise, this variant offers the best raw multi-threaded performance.
|
|
@@ -83,11 +83,7 @@ class Hasher(Protocol):
|
|
|
83
83
|
-------
|
|
84
84
|
```python
|
|
85
85
|
hasher = GxHash128(seed=1234)
|
|
86
|
-
|
|
87
|
-
thread_pool = ThreadPoolExecutor()
|
|
88
|
-
future = thread_pool.submit(hasher.hash_nogil, input_bytes)
|
|
89
|
-
hash_result = await wrap_future(future)
|
|
90
|
-
print(f"Hash is {hash_result}!")
|
|
86
|
+
print(f"Hash is {await hasher.hash_async(bytes([42] * 1000))}!")
|
|
91
87
|
```
|
|
92
88
|
"""
|
|
93
89
|
def hash_file(self, file: File) -> int:
|
|
@@ -97,9 +93,9 @@ class Hasher(Protocol):
|
|
|
97
93
|
Hashes a `File` to an `int`.
|
|
98
94
|
This method duplicates the file descriptor and memory maps the file entirely in Rust.
|
|
99
95
|
This operation is many times faster than reading the file in Python and passing the bytes to the hasher.
|
|
100
|
-
If your input is already in `bytes`, this method may be slightly less performant than `hash` and `
|
|
96
|
+
If your input is already in `bytes`, this method may be slightly less performant than `hash` and `hash_async`.
|
|
101
97
|
If the `bytes` is really large, writing to a `TemporaryFile` and passing it to this method may be more
|
|
102
|
-
performant than passing the `bytes` directly to `hash` or `
|
|
98
|
+
performant than passing the `bytes` directly to `hash` or `hash_async`.
|
|
103
99
|
|
|
104
100
|
Parameters
|
|
105
101
|
----------
|
|
@@ -138,7 +134,7 @@ class Hasher(Protocol):
|
|
|
138
134
|
Asynchronous variant of `hash_file`.
|
|
139
135
|
This method allows you to perform multiple hashes with true multi-threaded parallelism.
|
|
140
136
|
If called sequentially, this method is slightly less performant than `hash_file`.
|
|
141
|
-
It is only ever faster than a multi-threaded `
|
|
137
|
+
It is only ever faster than a multi-threaded `hash_async` when the input is a `File`,
|
|
142
138
|
and that is due to the performance overhead of reading a `File` in Python.
|
|
143
139
|
|
|
144
140
|
Parameters
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gxhash"
|
|
3
|
-
|
|
3
|
+
license = "MIT"
|
|
4
4
|
requires-python = ">=3.7"
|
|
5
5
|
dynamic = ["version"]
|
|
6
6
|
classifiers = [
|
|
@@ -10,12 +10,13 @@ classifiers = [
|
|
|
10
10
|
]
|
|
11
11
|
|
|
12
12
|
[dependency-groups]
|
|
13
|
-
dev = ["maturin
|
|
13
|
+
dev = ["maturin==1.6.0"]
|
|
14
14
|
|
|
15
15
|
[build-system]
|
|
16
|
-
requires = ["maturin>=1.
|
|
16
|
+
requires = ["maturin>=1.6.0, <2.0.0"]
|
|
17
17
|
build-backend = "maturin"
|
|
18
18
|
|
|
19
19
|
[tool.maturin]
|
|
20
20
|
features = ["pyo3/extension-module"]
|
|
21
|
-
|
|
21
|
+
exclude = ["**/uv.lock"]
|
|
22
|
+
|
|
@@ -10,13 +10,8 @@ fn gxhash<T>(hasher: fn(&[u8], i64) -> T, bytes: &[u8], seed: i64) -> PyResult<T
|
|
|
10
10
|
Ok(hasher(bytes, seed))
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
fn gxhash_nogil<T: Send>(py: Python, hasher: fn(&[u8], i64) -> T, bytes: &[u8], seed: i64) -> PyResult<T> {
|
|
14
|
-
py.allow_threads(|| gxhash(hasher, bytes, seed))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
fn gxhash_file<T>(hasher: fn(&[u8], i64) -> T, file_descriptor: i32, seed: i64) -> PyResult<T> {
|
|
18
|
-
let
|
|
19
|
-
let mmap = unsafe { memmap2::Mmap::map(&file)? };
|
|
14
|
+
let mmap = unsafe { memmap2::Mmap::map(&std::fs::File::from_raw_fd(libc::dup(file_descriptor)))? };
|
|
20
15
|
Ok(hasher(&mmap, seed))
|
|
21
16
|
}
|
|
22
17
|
|
|
@@ -52,8 +47,12 @@ impl GxHash32 {
|
|
|
52
47
|
gxhash(self.hasher, bytes, self.seed)
|
|
53
48
|
}
|
|
54
49
|
|
|
55
|
-
fn
|
|
56
|
-
|
|
50
|
+
fn hash_async<'a>(&self, py: Python<'a>, bytes: &'a [u8]) -> PyResult<Bound<'a, PyAny>> {
|
|
51
|
+
let seed = self.seed;
|
|
52
|
+
let hasher = self.hasher;
|
|
53
|
+
let bytes_static = unsafe { std::mem::transmute::<&'a [u8], &'static [u8]>(bytes) };
|
|
54
|
+
|
|
55
|
+
future_into_py(py, async move { gxhash(hasher, bytes_static, seed) })
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
fn hash_file(&self, py: Python, file: PyObject) -> PyResult<u32> {
|
|
@@ -83,8 +82,12 @@ impl GxHash64 {
|
|
|
83
82
|
gxhash(self.hasher, bytes, self.seed)
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
fn
|
|
87
|
-
|
|
85
|
+
fn hash_async<'a>(&self, py: Python<'a>, bytes: &'a [u8]) -> PyResult<Bound<'a, PyAny>> {
|
|
86
|
+
let seed = self.seed;
|
|
87
|
+
let hasher = self.hasher;
|
|
88
|
+
let bytes_static = unsafe { std::mem::transmute::<&'a [u8], &'static [u8]>(bytes) };
|
|
89
|
+
|
|
90
|
+
future_into_py(py, async move { gxhash(hasher, bytes_static, seed) })
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
fn hash_file(&self, py: Python, file: PyObject) -> PyResult<u64> {
|
|
@@ -114,8 +117,12 @@ impl GxHash128 {
|
|
|
114
117
|
gxhash(self.hasher, bytes, self.seed)
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
fn
|
|
118
|
-
|
|
120
|
+
fn hash_async<'a>(&self, py: Python<'a>, bytes: &'a [u8]) -> PyResult<Bound<'a, PyAny>> {
|
|
121
|
+
let seed = self.seed;
|
|
122
|
+
let hasher = self.hasher;
|
|
123
|
+
let bytes_static = unsafe { std::mem::transmute::<&'a [u8], &'static [u8]>(bytes) };
|
|
124
|
+
|
|
125
|
+
future_into_py(py, async move { gxhash(hasher, bytes_static, seed) })
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
fn hash_file(&self, py: Python, file: PyObject) -> PyResult<u128> {
|
gxhash-0.1.2/.cargo/config.toml
DELETED
gxhash-0.1.2/.gitattributes
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*.tex linguist-detectable=false
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
name: Benchmark
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
|
|
6
|
-
env:
|
|
7
|
-
CARGO_TERM_COLOR: always
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
benchmark-x86:
|
|
11
|
-
name: Benchmark X86
|
|
12
|
-
runs-on: buildjet-2vcpu-ubuntu-2204
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Update rust
|
|
18
|
-
run: rustup update
|
|
19
|
-
|
|
20
|
-
- name: Benchmark
|
|
21
|
-
run: cargo bench --bench throughput --features bench-plot
|
|
22
|
-
|
|
23
|
-
- uses: actions/upload-artifact@v3
|
|
24
|
-
with:
|
|
25
|
-
name: benches
|
|
26
|
-
path: benches/throughput/x86_64.svg
|
|
27
|
-
|
|
28
|
-
benchmark-x86-avx2:
|
|
29
|
-
name: Benchmark X86 AVX2
|
|
30
|
-
runs-on: buildjet-2vcpu-ubuntu-2204
|
|
31
|
-
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v4
|
|
34
|
-
|
|
35
|
-
- name: Switch to nightly rust
|
|
36
|
-
run: rustup default nightly
|
|
37
|
-
|
|
38
|
-
- name: Benchmark
|
|
39
|
-
run: cargo bench --bench throughput --features bench-plot,hybrid
|
|
40
|
-
|
|
41
|
-
- uses: actions/upload-artifact@v3
|
|
42
|
-
with:
|
|
43
|
-
name: benches
|
|
44
|
-
path: benches/throughput/x86_64-hybrid.svg
|
|
45
|
-
|
|
46
|
-
benchmark-arm:
|
|
47
|
-
name: Benchmark ARM
|
|
48
|
-
runs-on: buildjet-2vcpu-ubuntu-2204-arm
|
|
49
|
-
|
|
50
|
-
steps:
|
|
51
|
-
- uses: actions/checkout@v4
|
|
52
|
-
|
|
53
|
-
- name: Update rust
|
|
54
|
-
run: rustup update
|
|
55
|
-
|
|
56
|
-
- name: Benchmark
|
|
57
|
-
run: cargo bench --bench throughput --features bench-plot
|
|
58
|
-
|
|
59
|
-
- uses: actions/upload-artifact@v3
|
|
60
|
-
with:
|
|
61
|
-
name: benches
|
|
62
|
-
path: benches/throughput/aarch64.svg
|
|
63
|
-
|
|
64
|
-
commit:
|
|
65
|
-
name: Commit & Push
|
|
66
|
-
runs-on: buildjet-2vcpu-ubuntu-2204
|
|
67
|
-
needs: [benchmark-x86, benchmark-x86-avx2, benchmark-arm]
|
|
68
|
-
|
|
69
|
-
permissions:
|
|
70
|
-
contents: write
|
|
71
|
-
|
|
72
|
-
steps:
|
|
73
|
-
- uses: actions/checkout@v4
|
|
74
|
-
|
|
75
|
-
- name: Download Benchmark Results
|
|
76
|
-
uses: actions/download-artifact@v3
|
|
77
|
-
with:
|
|
78
|
-
name: benches
|
|
79
|
-
path: benches/throughput
|
|
80
|
-
|
|
81
|
-
- name: Commit & Push Benchmark Results
|
|
82
|
-
uses: stefanzweifel/git-auto-commit-action@v5
|
|
83
|
-
with:
|
|
84
|
-
file_pattern: '*.svg'
|
|
85
|
-
commit_message: Update Benchmark Results
|
|
86
|
-
commit_user_name: Benchmark Bot
|
|
87
|
-
commit_user_email: benchmark-bot@noreply.com
|
|
88
|
-
commit_author: Benchmark Bot <benchmark-bot@noreply.com>
|
|
89
|
-
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
name: Build & Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "main" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "main" ]
|
|
8
|
-
|
|
9
|
-
env:
|
|
10
|
-
CARGO_TERM_COLOR: always
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build_test_x86:
|
|
14
|
-
name: Build & Test X86
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v3
|
|
19
|
-
|
|
20
|
-
- name: Rust version
|
|
21
|
-
run: cargo rustc -- --version
|
|
22
|
-
|
|
23
|
-
- name: Build
|
|
24
|
-
run: cargo build --release
|
|
25
|
-
|
|
26
|
-
- name: Test
|
|
27
|
-
run: cargo test --release
|
|
28
|
-
|
|
29
|
-
build_test_x86_avx2:
|
|
30
|
-
name: Build & Test X86 AVX2
|
|
31
|
-
runs-on: ubuntu-latest
|
|
32
|
-
|
|
33
|
-
steps:
|
|
34
|
-
- uses: actions/checkout@v3
|
|
35
|
-
|
|
36
|
-
- name: Switch to nightly rust
|
|
37
|
-
run: rustup default nightly
|
|
38
|
-
|
|
39
|
-
- name: Rust version
|
|
40
|
-
run: cargo rustc -- --version
|
|
41
|
-
|
|
42
|
-
- name: Build
|
|
43
|
-
run: cargo build --release --features hybrid
|
|
44
|
-
|
|
45
|
-
- name: Test
|
|
46
|
-
run: cargo test --release --features hybrid
|
|
47
|
-
|
|
48
|
-
build_test_arm:
|
|
49
|
-
name: Build & Test ARM
|
|
50
|
-
runs-on: macos-latest
|
|
51
|
-
|
|
52
|
-
steps:
|
|
53
|
-
- uses: actions/checkout@v3
|
|
54
|
-
|
|
55
|
-
- name: Rust version
|
|
56
|
-
run: cargo rustc -- --version
|
|
57
|
-
|
|
58
|
-
- name: Build
|
|
59
|
-
run: cargo build --release
|
|
60
|
-
|
|
61
|
-
- name: Test
|
|
62
|
-
run: cargo test --release
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
name: Cross Compile
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
# Trigger when merged on main
|
|
5
|
-
push:
|
|
6
|
-
branches: [ "main" ]
|
|
7
|
-
pull_request:
|
|
8
|
-
branches: [ "main" ]
|
|
9
|
-
# Manual trigger
|
|
10
|
-
workflow_dispatch:
|
|
11
|
-
|
|
12
|
-
env:
|
|
13
|
-
CARGO_TERM_COLOR: always
|
|
14
|
-
RUSTFLAGS: "-C target-feature=+aes,+vaes,+avx2"
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
|
|
18
|
-
build_x86:
|
|
19
|
-
name: Build
|
|
20
|
-
|
|
21
|
-
strategy:
|
|
22
|
-
fail-fast: false
|
|
23
|
-
matrix:
|
|
24
|
-
include:
|
|
25
|
-
- from: ubuntu-latest
|
|
26
|
-
target: "aarch64-apple-darwin"
|
|
27
|
-
allow_failure_hybrid: true
|
|
28
|
-
- from: ubuntu-latest
|
|
29
|
-
target: "aarch64-unknown-linux-gnu"
|
|
30
|
-
allow_failure_hybrid: true
|
|
31
|
-
- from: ubuntu-latest
|
|
32
|
-
target: "aarch64-unknown-linux-musl"
|
|
33
|
-
allow_failure_hybrid: true
|
|
34
|
-
- from: ubuntu-latest
|
|
35
|
-
target: "i686-unknown-linux-gnu"
|
|
36
|
-
allow_failure_hybrid: true
|
|
37
|
-
- from: ubuntu-latest
|
|
38
|
-
target: "x86_64-pc-windows-msvc"
|
|
39
|
-
allow_failure_hybrid: true # Supposed to work as hybrid but not tested yet
|
|
40
|
-
- from: ubuntu-latest
|
|
41
|
-
target: "x86_64-unknown-linux-gnu"
|
|
42
|
-
allow_failure_hybrid: false
|
|
43
|
-
- from: macos-latest
|
|
44
|
-
target: "aarch64-apple-darwin"
|
|
45
|
-
allow_failure_hybrid: true
|
|
46
|
-
- from: macos-latest
|
|
47
|
-
target: "x86_64-unknown-linux-gnu"
|
|
48
|
-
allow_failure_hybrid: true # Supposed to work as hybrid but not tested yet
|
|
49
|
-
|
|
50
|
-
runs-on: ${{ matrix.from }}
|
|
51
|
-
|
|
52
|
-
steps:
|
|
53
|
-
- uses: actions/checkout@v3
|
|
54
|
-
|
|
55
|
-
- name: Install target
|
|
56
|
-
run: rustup target add ${{ matrix.target }}
|
|
57
|
-
|
|
58
|
-
- name: Build
|
|
59
|
-
run: cargo build --release --target ${{ matrix.target }}
|
|
60
|
-
|
|
61
|
-
- name: Switch to nightly rust
|
|
62
|
-
run: rustup default nightly
|
|
63
|
-
|
|
64
|
-
- name: Build Hybrid
|
|
65
|
-
continue-on-error: ${{ matrix.allow_failure_hybrid }}
|
|
66
|
-
run: cargo build --release --features hybrid --target ${{ matrix.target }}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: Rust Version Compatibility
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
# Trigger when merged on main
|
|
5
|
-
push:
|
|
6
|
-
branches: [ "main" ]
|
|
7
|
-
# Manual trigger
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
env:
|
|
11
|
-
CARGO_TERM_COLOR: always
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
|
|
15
|
-
build_test_x86:
|
|
16
|
-
name: Build & Test X86
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
|
|
19
|
-
strategy:
|
|
20
|
-
fail-fast: false
|
|
21
|
-
matrix:
|
|
22
|
-
version: ["1.65", "1.72", "1.78"]
|
|
23
|
-
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v3
|
|
26
|
-
|
|
27
|
-
- name: Install ${{ matrix.version }}
|
|
28
|
-
run: rustup toolchain install ${{ matrix.version }}
|
|
29
|
-
|
|
30
|
-
- name: Build
|
|
31
|
-
run: cargo +${{ matrix.version }} build --release
|