naw 0.0.1__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.
- naw-0.0.1/LICENSE +21 -0
- naw-0.0.1/PKG-INFO +28 -0
- naw-0.0.1/README.md +13 -0
- naw-0.0.1/pyproject.toml +97 -0
- naw-0.0.1/setup.cfg +4 -0
- naw-0.0.1/setup.py +36 -0
- naw-0.0.1/src/naw/__init__.py +0 -0
- naw-0.0.1/src/naw/_bfloat16.pyi +13 -0
- naw-0.0.1/src/naw/_float16.pyi +11 -0
- naw-0.0.1/src/naw/_float32.pyi +11 -0
- naw-0.0.1/src/naw/_float64.pyi +11 -0
- naw-0.0.1/src/naw/_leb.pyi +6 -0
- naw-0.0.1/src/naw/bench_bfloat16.py +69 -0
- naw-0.0.1/src/naw/bench_byteio.py +241 -0
- naw-0.0.1/src/naw/bench_float16.py +38 -0
- naw-0.0.1/src/naw/bench_float32.py +38 -0
- naw-0.0.1/src/naw/bench_float64.py +38 -0
- naw-0.0.1/src/naw/bench_leb.py +62 -0
- naw-0.0.1/src/naw/bfloat16.py +53 -0
- naw-0.0.1/src/naw/byteio.py +310 -0
- naw-0.0.1/src/naw/chunk.py +161 -0
- naw-0.0.1/src/naw/cli.py +513 -0
- naw-0.0.1/src/naw/exceptions.py +10 -0
- naw-0.0.1/src/naw/float16.py +33 -0
- naw-0.0.1/src/naw/float32.py +33 -0
- naw-0.0.1/src/naw/float64.py +33 -0
- naw-0.0.1/src/naw/leb.py +72 -0
- naw-0.0.1/src/naw/rtsdb.py +1291 -0
- naw-0.0.1/src/naw/test_bfloat16.py +39 -0
- naw-0.0.1/src/naw/test_byteio.py +262 -0
- naw-0.0.1/src/naw/test_chunk.py +190 -0
- naw-0.0.1/src/naw/test_float16.py +19 -0
- naw-0.0.1/src/naw/test_float32.py +19 -0
- naw-0.0.1/src/naw/test_float64.py +19 -0
- naw-0.0.1/src/naw/test_leb.py +51 -0
- naw-0.0.1/src/naw/test_rtsdb.py +312 -0
- naw-0.0.1/src/naw/test_wandb.py +460 -0
- naw-0.0.1/src/naw/utils.py +19 -0
- naw-0.0.1/src/naw/wandb.py +509 -0
- naw-0.0.1/src/naw.egg-info/PKG-INFO +28 -0
- naw-0.0.1/src/naw.egg-info/SOURCES.txt +43 -0
- naw-0.0.1/src/naw.egg-info/dependency_links.txt +1 -0
- naw-0.0.1/src/naw.egg-info/entry_points.txt +2 -0
- naw-0.0.1/src/naw.egg-info/requires.txt +3 -0
- naw-0.0.1/src/naw.egg-info/top_level.txt +1 -0
naw-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 INRIA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
naw-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: naw
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Log and manage metrics for machine learning projects
|
|
5
|
+
Author-email: Mathieu Lacage <mathieu.lacage@inria.fr>
|
|
6
|
+
Maintainer-email: Mathieu Lacage <mathieu.lacage@inria.fr>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: argcomplete>=3.7.0
|
|
12
|
+
Requires-Dist: pyyaml
|
|
13
|
+
Requires-Dist: tabulate
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# baw
|
|
17
|
+
|
|
18
|
+
This library logs time-series metrics to disk in compressed format.
|
|
19
|
+
|
|
20
|
+
## References
|
|
21
|
+
|
|
22
|
+
- [Gorilla](https://www.vldb.org/pvldb/vol8/p1816-teller.pdf): A fast, scalable, in-memory time series database
|
|
23
|
+
- [Chimp](https://www.vldb.org/pvldb/vol15/p3058-liakos.pdf): efficient lossless floating point compression for time series databases
|
|
24
|
+
- [Elf](https://www.vldb.org/pvldb/vol16/p1763-li.pdf): Erasing-Based Lossless Floating-Point Compression
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT — see [LICENSE](https://gitlab.inria.fr/mlacage/baw/-/raw/main/LICENSE?ref_type=heads).
|
naw-0.0.1/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# baw
|
|
2
|
+
|
|
3
|
+
This library logs time-series metrics to disk in compressed format.
|
|
4
|
+
|
|
5
|
+
## References
|
|
6
|
+
|
|
7
|
+
- [Gorilla](https://www.vldb.org/pvldb/vol8/p1816-teller.pdf): A fast, scalable, in-memory time series database
|
|
8
|
+
- [Chimp](https://www.vldb.org/pvldb/vol15/p3058-liakos.pdf): efficient lossless floating point compression for time series databases
|
|
9
|
+
- [Elf](https://www.vldb.org/pvldb/vol16/p1763-li.pdf): Erasing-Based Lossless Floating-Point Compression
|
|
10
|
+
|
|
11
|
+
## License
|
|
12
|
+
|
|
13
|
+
MIT — see [LICENSE](https://gitlab.inria.fr/mlacage/baw/-/raw/main/LICENSE?ref_type=heads).
|
naw-0.0.1/pyproject.toml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "naw"
|
|
3
|
+
description = "Log and manage metrics for machine learning projects"
|
|
4
|
+
version = "0.0.1"
|
|
5
|
+
dependencies = [
|
|
6
|
+
"argcomplete>=3.7.0",
|
|
7
|
+
"pyyaml",
|
|
8
|
+
"tabulate",
|
|
9
|
+
]
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Mathieu Lacage", email = "mathieu.lacage@inria.fr"}
|
|
13
|
+
]
|
|
14
|
+
maintainers = [
|
|
15
|
+
{name = "Mathieu Lacage", email = "mathieu.lacage@inria.fr"}
|
|
16
|
+
]
|
|
17
|
+
license = "MIT"
|
|
18
|
+
readme = "README.md"
|
|
19
|
+
|
|
20
|
+
[project.scripts]
|
|
21
|
+
naw = "naw.cli:main"
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
|
|
25
|
+
[build-system]
|
|
26
|
+
requires = ["setuptools>=68"]
|
|
27
|
+
build-backend = "setuptools.build_meta"
|
|
28
|
+
|
|
29
|
+
[dependency-groups]
|
|
30
|
+
dev = [
|
|
31
|
+
"cython>=3.0",
|
|
32
|
+
"licensecheck>=2025.1.0",
|
|
33
|
+
"matplotlib>=3.10.9",
|
|
34
|
+
"pre-commit>=3.5.0",
|
|
35
|
+
"pyright>=1.1.411",
|
|
36
|
+
"pytest>=8.3.5",
|
|
37
|
+
"pytest-benchmark>=5.1.0",
|
|
38
|
+
"ruff>=0.15.21",
|
|
39
|
+
"setuptools>=82.0.1",
|
|
40
|
+
"towncrier>=25.8.0",
|
|
41
|
+
"tox>=4.23.0",
|
|
42
|
+
"tox-uv>=1.11.0",
|
|
43
|
+
"uniplot>=0.23.2",
|
|
44
|
+
"zensical>=0.0.50",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[tool.pyright]
|
|
48
|
+
typeCheckingMode = "strict"
|
|
49
|
+
|
|
50
|
+
[tool.towncrier]
|
|
51
|
+
package = "naw"
|
|
52
|
+
package_dir = "src"
|
|
53
|
+
directory = "changes"
|
|
54
|
+
filename = "CHANGELOG.md"
|
|
55
|
+
start_string = "<!-- towncrier release notes start -->\n"
|
|
56
|
+
underlines = ["", "", ""]
|
|
57
|
+
title_format = "## [{version}] - {project_date}"
|
|
58
|
+
issue_format = "[#{issue}]"
|
|
59
|
+
|
|
60
|
+
[[tool.towncrier.type]]
|
|
61
|
+
directory = "highlight"
|
|
62
|
+
name = "Highlights"
|
|
63
|
+
showcontent = true
|
|
64
|
+
|
|
65
|
+
[[tool.towncrier.type]]
|
|
66
|
+
directory = "feature"
|
|
67
|
+
name = "Features"
|
|
68
|
+
showcontent = true
|
|
69
|
+
|
|
70
|
+
[[tool.towncrier.type]]
|
|
71
|
+
directory = "bugfix"
|
|
72
|
+
name = "Bugfixes"
|
|
73
|
+
showcontent = true
|
|
74
|
+
|
|
75
|
+
[[tool.towncrier.type]]
|
|
76
|
+
directory = "doc"
|
|
77
|
+
name = "Improved Documentation"
|
|
78
|
+
showcontent = true
|
|
79
|
+
|
|
80
|
+
[[tool.towncrier.type]]
|
|
81
|
+
directory = "removal"
|
|
82
|
+
name = "Deprecations and Removals"
|
|
83
|
+
showcontent = true
|
|
84
|
+
|
|
85
|
+
[[tool.towncrier.type]]
|
|
86
|
+
directory = "misc"
|
|
87
|
+
name = "Misc"
|
|
88
|
+
showcontent = false
|
|
89
|
+
|
|
90
|
+
[tool.tox]
|
|
91
|
+
env_list = ["py310", "py311", "py312", "py313", "py314"]
|
|
92
|
+
requires = ["tox-uv>=1.11"]
|
|
93
|
+
|
|
94
|
+
[tool.tox.env_run_base]
|
|
95
|
+
package = "editable"
|
|
96
|
+
dependency_groups = ["dev"]
|
|
97
|
+
commands = [["pytest", "{posargs}"]]
|
naw-0.0.1/setup.cfg
ADDED
naw-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
import setuptools
|
|
4
|
+
import setuptools.extension
|
|
5
|
+
|
|
6
|
+
ext_modules: list[typing.Any]
|
|
7
|
+
try:
|
|
8
|
+
import Cython.Build
|
|
9
|
+
|
|
10
|
+
ext_modules = typing.cast(
|
|
11
|
+
"list[typing.Any]",
|
|
12
|
+
Cython.Build.cythonize( # type: ignore[reportUnknownMemberType]
|
|
13
|
+
[
|
|
14
|
+
setuptools.extension.Extension(
|
|
15
|
+
"baw._leb", sources=["src/baw/_leb.pyx"]
|
|
16
|
+
),
|
|
17
|
+
setuptools.extension.Extension(
|
|
18
|
+
"baw._bfloat16", sources=["src/baw/_bfloat16.pyx"]
|
|
19
|
+
),
|
|
20
|
+
setuptools.extension.Extension(
|
|
21
|
+
"baw._float16", sources=["src/baw/_float16.pyx"]
|
|
22
|
+
),
|
|
23
|
+
setuptools.extension.Extension(
|
|
24
|
+
"baw._float32", sources=["src/baw/_float32.pyx"]
|
|
25
|
+
),
|
|
26
|
+
setuptools.extension.Extension(
|
|
27
|
+
"baw._float64", sources=["src/baw/_float64.pyx"]
|
|
28
|
+
),
|
|
29
|
+
],
|
|
30
|
+
compiler_directives={"language_level": "3"},
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
except ImportError:
|
|
34
|
+
ext_modules = []
|
|
35
|
+
|
|
36
|
+
setuptools.setup(ext_modules=ext_modules)
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
|
|
3
|
+
def write_bfloat16_array(data: collections.abc.Iterable[float]) -> list[int]: ...
|
|
4
|
+
def write_bfloat16_xor_array(
|
|
5
|
+
values: collections.abc.Iterable[float],
|
|
6
|
+
previous_values: collections.abc.Iterable[float],
|
|
7
|
+
) -> list[int]: ...
|
|
8
|
+
def read_bfloat16_array(data: bytes, n: int) -> tuple[int, list[float]]: ...
|
|
9
|
+
def read_bfloat16_xor_array(
|
|
10
|
+
data: bytes,
|
|
11
|
+
n: int,
|
|
12
|
+
previous_values: collections.abc.Sequence[float],
|
|
13
|
+
) -> tuple[int, list[float]]: ...
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
|
|
3
|
+
def write_float16_xor_array(
|
|
4
|
+
values: collections.abc.Iterable[float],
|
|
5
|
+
previous_values: collections.abc.Iterable[float],
|
|
6
|
+
) -> list[int]: ...
|
|
7
|
+
def read_float16_xor_array(
|
|
8
|
+
data: bytes,
|
|
9
|
+
n: int,
|
|
10
|
+
previous_values: collections.abc.Sequence[float],
|
|
11
|
+
) -> tuple[int, list[float]]: ...
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
|
|
3
|
+
def write_float32_xor_array(
|
|
4
|
+
values: collections.abc.Iterable[float],
|
|
5
|
+
previous_values: collections.abc.Iterable[float],
|
|
6
|
+
) -> list[int]: ...
|
|
7
|
+
def read_float32_xor_array(
|
|
8
|
+
data: bytes,
|
|
9
|
+
n: int,
|
|
10
|
+
previous_values: collections.abc.Sequence[float],
|
|
11
|
+
) -> tuple[int, list[float]]: ...
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
|
|
3
|
+
def write_float64_xor_array(
|
|
4
|
+
values: collections.abc.Iterable[float],
|
|
5
|
+
previous_values: collections.abc.Iterable[float],
|
|
6
|
+
) -> list[int]: ...
|
|
7
|
+
def read_float64_xor_array(
|
|
8
|
+
data: bytes,
|
|
9
|
+
n: int,
|
|
10
|
+
previous_values: collections.abc.Sequence[float],
|
|
11
|
+
) -> tuple[int, list[float]]: ...
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
|
|
3
|
+
def read_unsigned_array(data: bytes, n: int) -> tuple[int, list[int]]: ...
|
|
4
|
+
def read_signed_array(data: bytes, n: int) -> tuple[int, list[int]]: ...
|
|
5
|
+
def write_unsigned_array(data: collections.abc.Iterable[int]) -> list[int]: ...
|
|
6
|
+
def write_signed_array(data: collections.abc.Iterable[int]) -> list[int]: ...
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import pytest_benchmark.fixture
|
|
3
|
+
|
|
4
|
+
from . import bfloat16
|
|
5
|
+
|
|
6
|
+
N = 1000
|
|
7
|
+
|
|
8
|
+
_float_values = [float(i) for i in range(N)]
|
|
9
|
+
_float_prev_values = [float(i) for i in range(-1, N - 1)]
|
|
10
|
+
_bf16_data = bytes(bfloat16.write_bfloat16_array(_float_values))
|
|
11
|
+
_bf16_xor_data = bytes(
|
|
12
|
+
bfloat16.write_bfloat16_xor_array(_float_values, _float_prev_values)
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_py_write_bfloat16_array(
|
|
17
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
18
|
+
) -> None:
|
|
19
|
+
benchmark(lambda: bfloat16.write_bfloat16_array(_float_values))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_py_read_bfloat16_array(
|
|
23
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
24
|
+
) -> None:
|
|
25
|
+
benchmark(lambda: bfloat16.read_bfloat16_array(_bf16_data, N))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_py_write_bfloat16_xor_array(
|
|
29
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
30
|
+
) -> None:
|
|
31
|
+
benchmark(
|
|
32
|
+
lambda: bfloat16.write_bfloat16_xor_array(_float_values, _float_prev_values)
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_py_read_bfloat16_xor_array(
|
|
37
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
38
|
+
) -> None:
|
|
39
|
+
benchmark(
|
|
40
|
+
lambda: bfloat16.read_bfloat16_xor_array(_bf16_xor_data, N, _float_prev_values)
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_cy_write_bfloat16_array(
|
|
45
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
46
|
+
) -> None:
|
|
47
|
+
cy = pytest.importorskip("baw._bfloat16")
|
|
48
|
+
benchmark(lambda: cy.write_bfloat16_array(_float_values))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_cy_read_bfloat16_array(
|
|
52
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
53
|
+
) -> None:
|
|
54
|
+
cy = pytest.importorskip("baw._bfloat16")
|
|
55
|
+
benchmark(lambda: cy.read_bfloat16_array(_bf16_data, N))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_cy_write_bfloat16_xor_array(
|
|
59
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
60
|
+
) -> None:
|
|
61
|
+
cy = pytest.importorskip("baw._bfloat16")
|
|
62
|
+
benchmark(lambda: cy.write_bfloat16_xor_array(_float_values, _float_prev_values))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_cy_read_bfloat16_xor_array(
|
|
66
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
67
|
+
) -> None:
|
|
68
|
+
cy = pytest.importorskip("baw._bfloat16")
|
|
69
|
+
benchmark(lambda: cy.read_bfloat16_xor_array(_bf16_xor_data, N, _float_prev_values))
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import pytest_benchmark.fixture
|
|
2
|
+
|
|
3
|
+
from . import byteio
|
|
4
|
+
|
|
5
|
+
N = 1000
|
|
6
|
+
|
|
7
|
+
_int_values = list(range(N))
|
|
8
|
+
_float_values = [float(i) for i in range(N)]
|
|
9
|
+
_float_prev_values = [float(i) for i in range(-1, N - 1)]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_write_sleb_array(benchmark: pytest_benchmark.fixture.BenchmarkFixture) -> None:
|
|
13
|
+
def run() -> None:
|
|
14
|
+
w = byteio.Writer()
|
|
15
|
+
w.write_sleb_array(_int_values)
|
|
16
|
+
|
|
17
|
+
benchmark(run)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_read_sleb_array(benchmark: pytest_benchmark.fixture.BenchmarkFixture) -> None:
|
|
21
|
+
w = byteio.Writer()
|
|
22
|
+
w.write_sleb_array(_int_values)
|
|
23
|
+
data = w.bytes
|
|
24
|
+
|
|
25
|
+
def run() -> None:
|
|
26
|
+
r = byteio.Reader(data)
|
|
27
|
+
r.read_sleb_array(N)
|
|
28
|
+
|
|
29
|
+
benchmark(run)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_write_uleb_array(benchmark: pytest_benchmark.fixture.BenchmarkFixture) -> None:
|
|
33
|
+
def run() -> None:
|
|
34
|
+
w = byteio.Writer()
|
|
35
|
+
w.write_uleb_array(_int_values)
|
|
36
|
+
|
|
37
|
+
benchmark(run)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_read_uleb_array(benchmark: pytest_benchmark.fixture.BenchmarkFixture) -> None:
|
|
41
|
+
w = byteio.Writer()
|
|
42
|
+
w.write_uleb_array(_int_values)
|
|
43
|
+
data = w.bytes
|
|
44
|
+
|
|
45
|
+
def run() -> None:
|
|
46
|
+
r = byteio.Reader(data)
|
|
47
|
+
r.read_uleb_array(N)
|
|
48
|
+
|
|
49
|
+
benchmark(run)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_write_float16_array(
|
|
53
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
54
|
+
) -> None:
|
|
55
|
+
def run() -> None:
|
|
56
|
+
w = byteio.Writer()
|
|
57
|
+
w.write_float16_array(_float_values)
|
|
58
|
+
|
|
59
|
+
benchmark(run)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_read_float16_array(
|
|
63
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
64
|
+
) -> None:
|
|
65
|
+
w = byteio.Writer()
|
|
66
|
+
w.write_float16_array(_float_values)
|
|
67
|
+
data = w.bytes
|
|
68
|
+
|
|
69
|
+
def run() -> None:
|
|
70
|
+
r = byteio.Reader(data)
|
|
71
|
+
r.read_float16_array(N)
|
|
72
|
+
|
|
73
|
+
benchmark(run)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_write_float16_xor_array(
|
|
77
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
78
|
+
) -> None:
|
|
79
|
+
def run() -> None:
|
|
80
|
+
w = byteio.Writer()
|
|
81
|
+
w.write_float16_xor_array(_float_values, _float_prev_values)
|
|
82
|
+
|
|
83
|
+
benchmark(run)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_read_float16_xor_array(
|
|
87
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
88
|
+
) -> None:
|
|
89
|
+
w = byteio.Writer()
|
|
90
|
+
w.write_float16_xor_array(_float_values, _float_prev_values)
|
|
91
|
+
data = w.bytes
|
|
92
|
+
|
|
93
|
+
def run() -> None:
|
|
94
|
+
r = byteio.Reader(data)
|
|
95
|
+
r.read_float16_xor_array(N, _float_prev_values)
|
|
96
|
+
|
|
97
|
+
benchmark(run)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_write_bfloat16_array(
|
|
101
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
102
|
+
) -> None:
|
|
103
|
+
def run() -> None:
|
|
104
|
+
w = byteio.Writer()
|
|
105
|
+
w.write_bfloat16_array(_float_values)
|
|
106
|
+
|
|
107
|
+
benchmark(run)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_read_bfloat16_array(
|
|
111
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
112
|
+
) -> None:
|
|
113
|
+
w = byteio.Writer()
|
|
114
|
+
w.write_bfloat16_array(_float_values)
|
|
115
|
+
data = w.bytes
|
|
116
|
+
|
|
117
|
+
def run() -> None:
|
|
118
|
+
r = byteio.Reader(data)
|
|
119
|
+
r.read_bfloat16_array(N)
|
|
120
|
+
|
|
121
|
+
benchmark(run)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def test_write_bfloat16_xor_array(
|
|
125
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
126
|
+
) -> None:
|
|
127
|
+
def run() -> None:
|
|
128
|
+
w = byteio.Writer()
|
|
129
|
+
w.write_bfloat16_xor_array(_float_values, _float_prev_values)
|
|
130
|
+
|
|
131
|
+
benchmark(run)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def test_read_bfloat16_xor_array(
|
|
135
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
136
|
+
) -> None:
|
|
137
|
+
w = byteio.Writer()
|
|
138
|
+
w.write_bfloat16_xor_array(_float_values, _float_prev_values)
|
|
139
|
+
data = w.bytes
|
|
140
|
+
|
|
141
|
+
def run() -> None:
|
|
142
|
+
r = byteio.Reader(data)
|
|
143
|
+
r.read_bfloat16_xor_array(N, _float_prev_values)
|
|
144
|
+
|
|
145
|
+
benchmark(run)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def test_write_float32_array(
|
|
149
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
150
|
+
) -> None:
|
|
151
|
+
def run() -> None:
|
|
152
|
+
w = byteio.Writer()
|
|
153
|
+
w.write_float32_array(_float_values)
|
|
154
|
+
|
|
155
|
+
benchmark(run)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def test_read_float32_array(
|
|
159
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
160
|
+
) -> None:
|
|
161
|
+
w = byteio.Writer()
|
|
162
|
+
w.write_float32_array(_float_values)
|
|
163
|
+
data = w.bytes
|
|
164
|
+
|
|
165
|
+
def run() -> None:
|
|
166
|
+
r = byteio.Reader(data)
|
|
167
|
+
r.read_float32_array(N)
|
|
168
|
+
|
|
169
|
+
benchmark(run)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def test_write_float32_xor_array(
|
|
173
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
174
|
+
) -> None:
|
|
175
|
+
def run() -> None:
|
|
176
|
+
w = byteio.Writer()
|
|
177
|
+
w.write_float32_xor_array(_float_values, _float_prev_values)
|
|
178
|
+
|
|
179
|
+
benchmark(run)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def test_read_float32_xor_array(
|
|
183
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
184
|
+
) -> None:
|
|
185
|
+
w = byteio.Writer()
|
|
186
|
+
w.write_float32_xor_array(_float_values, _float_prev_values)
|
|
187
|
+
data = w.bytes
|
|
188
|
+
|
|
189
|
+
def run() -> None:
|
|
190
|
+
r = byteio.Reader(data)
|
|
191
|
+
r.read_float32_xor_array(N, _float_prev_values)
|
|
192
|
+
|
|
193
|
+
benchmark(run)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def test_write_float64_array(
|
|
197
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
198
|
+
) -> None:
|
|
199
|
+
def run() -> None:
|
|
200
|
+
w = byteio.Writer()
|
|
201
|
+
w.write_float64_array(_float_values)
|
|
202
|
+
|
|
203
|
+
benchmark(run)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def test_read_float64_array(
|
|
207
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
208
|
+
) -> None:
|
|
209
|
+
w = byteio.Writer()
|
|
210
|
+
w.write_float64_array(_float_values)
|
|
211
|
+
data = w.bytes
|
|
212
|
+
|
|
213
|
+
def run() -> None:
|
|
214
|
+
r = byteio.Reader(data)
|
|
215
|
+
r.read_float64_array(N)
|
|
216
|
+
|
|
217
|
+
benchmark(run)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def test_write_float64_xor_array(
|
|
221
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
222
|
+
) -> None:
|
|
223
|
+
def run() -> None:
|
|
224
|
+
w = byteio.Writer()
|
|
225
|
+
w.write_float64_xor_array(_float_values, _float_prev_values)
|
|
226
|
+
|
|
227
|
+
benchmark(run)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def test_read_float64_xor_array(
|
|
231
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
232
|
+
) -> None:
|
|
233
|
+
w = byteio.Writer()
|
|
234
|
+
w.write_float64_xor_array(_float_values, _float_prev_values)
|
|
235
|
+
data = w.bytes
|
|
236
|
+
|
|
237
|
+
def run() -> None:
|
|
238
|
+
r = byteio.Reader(data)
|
|
239
|
+
r.read_float64_xor_array(N, _float_prev_values)
|
|
240
|
+
|
|
241
|
+
benchmark(run)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import pytest_benchmark.fixture
|
|
3
|
+
|
|
4
|
+
from . import float16
|
|
5
|
+
|
|
6
|
+
N = 1000
|
|
7
|
+
|
|
8
|
+
_float_values = [float(i) for i in range(N)]
|
|
9
|
+
_float_prev_values = [float(i) for i in range(-1, N - 1)]
|
|
10
|
+
_xor_data = bytes(float16.write_float16_xor_array(_float_values, _float_prev_values))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_py_write_float16_xor_array(
|
|
14
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
15
|
+
) -> None:
|
|
16
|
+
benchmark(
|
|
17
|
+
lambda: float16.write_float16_xor_array(_float_values, _float_prev_values)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_py_read_float16_xor_array(
|
|
22
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
23
|
+
) -> None:
|
|
24
|
+
benchmark(lambda: float16.read_float16_xor_array(_xor_data, N, _float_prev_values))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_cy_write_float16_xor_array(
|
|
28
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
29
|
+
) -> None:
|
|
30
|
+
cy = pytest.importorskip("baw._float16")
|
|
31
|
+
benchmark(lambda: cy.write_float16_xor_array(_float_values, _float_prev_values))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_cy_read_float16_xor_array(
|
|
35
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
36
|
+
) -> None:
|
|
37
|
+
cy = pytest.importorskip("baw._float16")
|
|
38
|
+
benchmark(lambda: cy.read_float16_xor_array(_xor_data, N, _float_prev_values))
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import pytest_benchmark.fixture
|
|
3
|
+
|
|
4
|
+
from . import float32
|
|
5
|
+
|
|
6
|
+
N = 1000
|
|
7
|
+
|
|
8
|
+
_float_values = [float(i) for i in range(N)]
|
|
9
|
+
_float_prev_values = [float(i) for i in range(-1, N - 1)]
|
|
10
|
+
_xor_data = bytes(float32.write_float32_xor_array(_float_values, _float_prev_values))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_py_write_float32_xor_array(
|
|
14
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
15
|
+
) -> None:
|
|
16
|
+
benchmark(
|
|
17
|
+
lambda: float32.write_float32_xor_array(_float_values, _float_prev_values)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_py_read_float32_xor_array(
|
|
22
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
23
|
+
) -> None:
|
|
24
|
+
benchmark(lambda: float32.read_float32_xor_array(_xor_data, N, _float_prev_values))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_cy_write_float32_xor_array(
|
|
28
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
29
|
+
) -> None:
|
|
30
|
+
cy = pytest.importorskip("baw._float32")
|
|
31
|
+
benchmark(lambda: cy.write_float32_xor_array(_float_values, _float_prev_values))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_cy_read_float32_xor_array(
|
|
35
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
36
|
+
) -> None:
|
|
37
|
+
cy = pytest.importorskip("baw._float32")
|
|
38
|
+
benchmark(lambda: cy.read_float32_xor_array(_xor_data, N, _float_prev_values))
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import pytest_benchmark.fixture
|
|
3
|
+
|
|
4
|
+
from . import float64
|
|
5
|
+
|
|
6
|
+
N = 1000
|
|
7
|
+
|
|
8
|
+
_float_values = [float(i) for i in range(N)]
|
|
9
|
+
_float_prev_values = [float(i) for i in range(-1, N - 1)]
|
|
10
|
+
_xor_data = bytes(float64.write_float64_xor_array(_float_values, _float_prev_values))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_py_write_float64_xor_array(
|
|
14
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
15
|
+
) -> None:
|
|
16
|
+
benchmark(
|
|
17
|
+
lambda: float64.write_float64_xor_array(_float_values, _float_prev_values)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_py_read_float64_xor_array(
|
|
22
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
23
|
+
) -> None:
|
|
24
|
+
benchmark(lambda: float64.read_float64_xor_array(_xor_data, N, _float_prev_values))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_cy_write_float64_xor_array(
|
|
28
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
29
|
+
) -> None:
|
|
30
|
+
cy = pytest.importorskip("baw._float64")
|
|
31
|
+
benchmark(lambda: cy.write_float64_xor_array(_float_values, _float_prev_values))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_cy_read_float64_xor_array(
|
|
35
|
+
benchmark: pytest_benchmark.fixture.BenchmarkFixture,
|
|
36
|
+
) -> None:
|
|
37
|
+
cy = pytest.importorskip("baw._float64")
|
|
38
|
+
benchmark(lambda: cy.read_float64_xor_array(_xor_data, N, _float_prev_values))
|