faster-eth-abi 5.2.5__tar.gz → 5.2.6__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.
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/PKG-INFO +17 -2
- faster_eth_abi-5.2.6/README.md +33 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/_encoding.py +4 -3
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/grammar.py +5 -4
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi.egg-info/PKG-INFO +17 -2
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi.egg-info/SOURCES.txt +3 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi.egg-info/requires.txt +2 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/pyproject.toml +1 -1
- faster_eth_abi-5.2.6/scripts/benchmark/compare_benchmark_results.py +101 -0
- faster_eth_abi-5.2.6/scripts/benchmark/generate_benchmark_markdown.py +85 -0
- faster_eth_abi-5.2.6/scripts/benchmark/parse_benchmark_output.py +83 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/setup.py +5 -2
- faster_eth_abi-5.2.5/README.md +0 -19
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/LICENSE +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/MANIFEST.in +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/_codec.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/abi.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/base.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/codec.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/constants.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/decoding.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/encoding.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/exceptions.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/from_type_str.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/io.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/packed.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/py.typed +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/registry.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/tools/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/tools/_strategies.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/utils/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/utils/numeric.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/utils/padding.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/utils/string.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi/utils/validation.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi.egg-info/dependency_links.txt +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi.egg-info/not-zip-safe +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/faster_eth_abi.egg-info/top_level.txt +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/scripts/release/test_package.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/setup.cfg +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_decode.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_encode.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_is_encodable.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_is_encodable_type.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_reversibility_properties.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_uint_properties.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/base.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/common/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/common/strategies.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/common/unit.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/decoding/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/decoding/test_context_frames_bytes_io.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/decoding/test_decoder_properties.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/encoding/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/encoding/test_encoder_properties.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/end_to_end/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/end_to_end/test_custom_registrations.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/grammar.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/packed/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/packed/test_encode_packed.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/packed/test_is_encodable_packed.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/registry/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/registry/test_abi_registry.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/registry/test_predicate_mapping.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/registry/test_predicates.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/test_import_and_version.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/test_tools.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/utils/__init__.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/utils/test_abbr.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/utils/test_ceil32.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/utils/test_scale_places.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/utils/test_validation_utils.py +0 -0
- {faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/utils/test_zpad.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: faster_eth_abi
|
3
|
-
Version: 5.2.
|
4
|
-
Summary: A fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
|
3
|
+
Version: 5.2.6
|
4
|
+
Summary: A aster fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding. Implemented in C.
|
5
5
|
Home-page: https://github.com/BobTheBuidler/faster-eth-abi
|
6
6
|
Author: The Ethereum Foundation
|
7
7
|
Author-email: snakecharmers@ethereum.org
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
20
20
|
Classifier: Programming Language :: Python :: 3.13
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
21
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
22
23
|
Requires-Python: >=3.8, <4
|
23
24
|
Description-Content-Type: text/markdown
|
@@ -27,6 +28,20 @@ Provides-Extra: test
|
|
27
28
|
Provides-Extra: tools
|
28
29
|
License-File: LICENSE
|
29
30
|
|
31
|
+
### I forked eth-abi and compiled it to C. It does the same stuff, now faster
|
32
|
+
|
33
|
+
[](https://pypi.org/project/faster-eth-abi/)
|
34
|
+
[](https://pypistats.org/packages/faster-eth-abi)
|
35
|
+
[](https://codspeed.io/BobTheBuidler/faster-eth-abi)
|
36
|
+
|
37
|
+
##### This fork will be kept up-to-date with [eth-abi](https://github.com/ethereum/eth-abi). I will pull updates as they are released and push new [faster-eth-abi](https://github.com/BobTheBuidler/faster-eth-abi) releases to [PyPI](https://pypi.org/project/faster-eth-abi/).
|
38
|
+
|
39
|
+
##### You can find the compiled C code on faster-eth-abi [master](https://github.com/BobTheBuidler/eth-abi/tree/master) branch.
|
40
|
+
|
41
|
+
##### We benchmark `faster-eth-abi` against the original `eth-abi` for your convenience. [See results](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/benchmarks/results).
|
42
|
+
|
43
|
+
##### The original eth-abi readme is below:
|
44
|
+
|
30
45
|
# Ethereum Contract Interface (ABI) Utility
|
31
46
|
|
32
47
|
[](https://discord.gg/GHryRvPB84)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
### I forked eth-abi and compiled it to C. It does the same stuff, now faster
|
2
|
+
|
3
|
+
[](https://pypi.org/project/faster-eth-abi/)
|
4
|
+
[](https://pypistats.org/packages/faster-eth-abi)
|
5
|
+
[](https://codspeed.io/BobTheBuidler/faster-eth-abi)
|
6
|
+
|
7
|
+
##### This fork will be kept up-to-date with [eth-abi](https://github.com/ethereum/eth-abi). I will pull updates as they are released and push new [faster-eth-abi](https://github.com/BobTheBuidler/faster-eth-abi) releases to [PyPI](https://pypi.org/project/faster-eth-abi/).
|
8
|
+
|
9
|
+
##### You can find the compiled C code on faster-eth-abi [master](https://github.com/BobTheBuidler/eth-abi/tree/master) branch.
|
10
|
+
|
11
|
+
##### We benchmark `faster-eth-abi` against the original `eth-abi` for your convenience. [See results](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/benchmarks/results).
|
12
|
+
|
13
|
+
##### The original eth-abi readme is below:
|
14
|
+
|
15
|
+
# Ethereum Contract Interface (ABI) Utility
|
16
|
+
|
17
|
+
[](https://discord.gg/GHryRvPB84)
|
18
|
+
[](https://circleci.com/gh/ethereum/faster-eth-abi)
|
19
|
+
[](https://badge.fury.io/py/faster-eth-abi)
|
20
|
+
[](https://pypi.python.org/pypi/faster-eth-abi)
|
21
|
+
[](https://faster-eth-abi.readthedocs.io/en/latest/?badge=latest)
|
22
|
+
|
23
|
+
Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
|
24
|
+
|
25
|
+
Read the [documentation](https://faster-eth-abi.readthedocs.io/).
|
26
|
+
|
27
|
+
View the [change log](https://faster-eth-abi.readthedocs.io/en/latest/release_notes.html).
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
|
31
|
+
```sh
|
32
|
+
python -m pip install faster-eth-abi
|
33
|
+
```
|
@@ -72,7 +72,7 @@ def encode_signed(
|
|
72
72
|
def encode_elements(item_encoder: "BaseEncoder", value: Sequence[Any]) -> bytes:
|
73
73
|
tail_chunks = tuple(item_encoder(i) for i in value)
|
74
74
|
|
75
|
-
items_are_dynamic = getattr(item_encoder, "is_dynamic", False)
|
75
|
+
items_are_dynamic: bool = getattr(item_encoder, "is_dynamic", False)
|
76
76
|
if not items_are_dynamic or len(value) == 0:
|
77
77
|
return b"".join(tail_chunks)
|
78
78
|
|
@@ -91,8 +91,9 @@ def encode_elements_dynamic(item_encoder: "BaseEncoder", value: Sequence[Any]) -
|
|
91
91
|
|
92
92
|
|
93
93
|
def encode_uint_256(i: int) -> bytes:
|
94
|
-
# An optimized version of the `encode_uint_256` in `encoding.py` which
|
95
|
-
# We should not have any issues here
|
94
|
+
# An optimized version of the `encode_uint_256` in `encoding.py` which
|
95
|
+
# does not perform any validation. We should not have any issues here
|
96
|
+
# unless you're encoding really really massive iterables.
|
96
97
|
big_endian = int_to_big_endian(i)
|
97
98
|
return big_endian.rjust(32, b"\x00")
|
98
99
|
|
@@ -458,10 +458,11 @@ def normalize(type_str: TypeStr) -> TypeStr:
|
|
458
458
|
:param type_str: The type string to be normalized.
|
459
459
|
:returns: The canonical version of the input type string.
|
460
460
|
"""
|
461
|
-
return TYPE_ALIAS_RE.sub(
|
462
|
-
|
463
|
-
|
464
|
-
|
461
|
+
return TYPE_ALIAS_RE.sub(__normalize, type_str)
|
462
|
+
|
463
|
+
|
464
|
+
def __normalize(match: re.Match[str]) -> str:
|
465
|
+
return TYPE_ALIASES[match.group(0)]
|
465
466
|
|
466
467
|
|
467
468
|
parse: Final = visitor.parse
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: faster-eth-abi
|
3
|
-
Version: 5.2.
|
4
|
-
Summary: A fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
|
3
|
+
Version: 5.2.6
|
4
|
+
Summary: A aster fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding. Implemented in C.
|
5
5
|
Home-page: https://github.com/BobTheBuidler/faster-eth-abi
|
6
6
|
Author: The Ethereum Foundation
|
7
7
|
Author-email: snakecharmers@ethereum.org
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
20
20
|
Classifier: Programming Language :: Python :: 3.13
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
21
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
22
23
|
Requires-Python: >=3.8, <4
|
23
24
|
Description-Content-Type: text/markdown
|
@@ -27,6 +28,20 @@ Provides-Extra: test
|
|
27
28
|
Provides-Extra: tools
|
28
29
|
License-File: LICENSE
|
29
30
|
|
31
|
+
### I forked eth-abi and compiled it to C. It does the same stuff, now faster
|
32
|
+
|
33
|
+
[](https://pypi.org/project/faster-eth-abi/)
|
34
|
+
[](https://pypistats.org/packages/faster-eth-abi)
|
35
|
+
[](https://codspeed.io/BobTheBuidler/faster-eth-abi)
|
36
|
+
|
37
|
+
##### This fork will be kept up-to-date with [eth-abi](https://github.com/ethereum/eth-abi). I will pull updates as they are released and push new [faster-eth-abi](https://github.com/BobTheBuidler/faster-eth-abi) releases to [PyPI](https://pypi.org/project/faster-eth-abi/).
|
38
|
+
|
39
|
+
##### You can find the compiled C code on faster-eth-abi [master](https://github.com/BobTheBuidler/eth-abi/tree/master) branch.
|
40
|
+
|
41
|
+
##### We benchmark `faster-eth-abi` against the original `eth-abi` for your convenience. [See results](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/benchmarks/results).
|
42
|
+
|
43
|
+
##### The original eth-abi readme is below:
|
44
|
+
|
30
45
|
# Ethereum Contract Interface (ABI) Utility
|
31
46
|
|
32
47
|
[](https://discord.gg/GHryRvPB84)
|
@@ -32,6 +32,9 @@ faster_eth_abi/utils/numeric.py
|
|
32
32
|
faster_eth_abi/utils/padding.py
|
33
33
|
faster_eth_abi/utils/string.py
|
34
34
|
faster_eth_abi/utils/validation.py
|
35
|
+
scripts/benchmark/compare_benchmark_results.py
|
36
|
+
scripts/benchmark/generate_benchmark_markdown.py
|
37
|
+
scripts/benchmark/parse_benchmark_output.py
|
35
38
|
scripts/release/test_package.py
|
36
39
|
tests/core/__init__.py
|
37
40
|
tests/core/base.py
|
@@ -0,0 +1,101 @@
|
|
1
|
+
"""
|
2
|
+
compare_benchmark_results.py
|
3
|
+
|
4
|
+
Compares the two implementations in each benchmark group from a pytest-benchmark parsed results JSON file,
|
5
|
+
grouped by submodule.
|
6
|
+
For each submodule and group (e.g., "abi_to_signature"), finds both implementations
|
7
|
+
(e.g., "test_abi_to_signature" and "test_faster_abi_to_signature"), computes the percent change
|
8
|
+
in mean execution time, speedup percent, and x factor, and writes a diff JSON file summarizing the results.
|
9
|
+
|
10
|
+
Usage:
|
11
|
+
python compare_benchmark_results.py <results.json> [output.json]
|
12
|
+
"""
|
13
|
+
|
14
|
+
import json
|
15
|
+
import re
|
16
|
+
import sys
|
17
|
+
from typing import (
|
18
|
+
Any,
|
19
|
+
Dict,
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
def get_group_name(test_name: str) -> str:
|
24
|
+
# Extract group from test name, e.g., test_foo, test_faster_foo -> group: foo
|
25
|
+
m = re.match(r"test_faster_(.+)", test_name)
|
26
|
+
if m:
|
27
|
+
return m.group(1)
|
28
|
+
m = re.match(r"test_(.+)", test_name)
|
29
|
+
if m:
|
30
|
+
return m.group(1)
|
31
|
+
return test_name
|
32
|
+
|
33
|
+
|
34
|
+
def compare_group(group_results: Dict[str, Any]) -> Dict[str, Any]:
|
35
|
+
# Find reference and faster implementations in the group
|
36
|
+
ref = None
|
37
|
+
fast = None
|
38
|
+
ref_name = None
|
39
|
+
fast_name = None
|
40
|
+
for func_name, data in group_results.items():
|
41
|
+
if func_name.startswith("test_faster_"):
|
42
|
+
fast = data
|
43
|
+
fast_name = func_name
|
44
|
+
elif func_name.startswith("test_"):
|
45
|
+
ref = data
|
46
|
+
ref_name = func_name
|
47
|
+
|
48
|
+
if ref and fast:
|
49
|
+
mean_ref = ref["mean"]
|
50
|
+
mean_fast = fast["mean"]
|
51
|
+
percent_change = (
|
52
|
+
((mean_ref - mean_fast) / mean_ref) * 100 if mean_ref != 0 else 0.0
|
53
|
+
)
|
54
|
+
speedup_x = mean_ref / mean_fast if mean_fast != 0 else float("inf")
|
55
|
+
speedup_percent = (
|
56
|
+
(speedup_x - 1) * 100 if speedup_x != float("inf") else float("inf")
|
57
|
+
)
|
58
|
+
return {
|
59
|
+
"reference_mean": mean_ref,
|
60
|
+
"faster_mean": mean_fast,
|
61
|
+
"percent_change": percent_change,
|
62
|
+
"speedup_percent": speedup_percent,
|
63
|
+
"speedup_x": speedup_x,
|
64
|
+
"reference": ref_name,
|
65
|
+
"faster": fast_name,
|
66
|
+
}
|
67
|
+
else:
|
68
|
+
missing = []
|
69
|
+
if not ref:
|
70
|
+
missing.append("reference")
|
71
|
+
if not fast:
|
72
|
+
missing.append("faster")
|
73
|
+
return {"note": f"Missing implementation(s): {missing}"}
|
74
|
+
|
75
|
+
|
76
|
+
def main() -> None:
|
77
|
+
if len(sys.argv) < 2:
|
78
|
+
print("Usage: python compare_benchmark_results.py <results.json> [output.json]")
|
79
|
+
sys.exit(1)
|
80
|
+
results_path = sys.argv[1]
|
81
|
+
output_path = sys.argv[2] if len(sys.argv) > 2 else "benchmark_diff.json"
|
82
|
+
|
83
|
+
with open(results_path) as f:
|
84
|
+
results = json.load(f)
|
85
|
+
|
86
|
+
# results: {submodule: {group: {function_name: {...}}}}
|
87
|
+
diff_by_submodule = {
|
88
|
+
submodule: {
|
89
|
+
group: compare_group(group_results)
|
90
|
+
for group, group_results in groups.items()
|
91
|
+
}
|
92
|
+
for submodule, groups in results.items()
|
93
|
+
}
|
94
|
+
|
95
|
+
with open(output_path, "w") as f:
|
96
|
+
json.dump(diff_by_submodule, f, indent=2)
|
97
|
+
print(f"Diff written to {output_path}")
|
98
|
+
|
99
|
+
|
100
|
+
if __name__ == "__main__":
|
101
|
+
main()
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import json
|
2
|
+
import os
|
3
|
+
|
4
|
+
|
5
|
+
def main():
|
6
|
+
diff_path = "pytest_benchmark_diff.json"
|
7
|
+
results_dir = os.path.join("benchmarks", "results")
|
8
|
+
os.makedirs(results_dir, exist_ok=True)
|
9
|
+
|
10
|
+
# Get repo and branch info from environment variables (for links)
|
11
|
+
repo = os.environ.get("GITHUB_REPOSITORY", "unknown/unknown")
|
12
|
+
branch = os.environ.get("GITHUB_HEAD_REF") or os.environ.get(
|
13
|
+
"GITHUB_REF", "main"
|
14
|
+
).replace("refs/heads/", "")
|
15
|
+
|
16
|
+
with open(diff_path, encoding="utf-8") as f:
|
17
|
+
diff = json.load(f)
|
18
|
+
|
19
|
+
for submodule, groupDiffs in diff.items():
|
20
|
+
# Convert submodule name to submodule file path (e.g., faster_eth_abi.encoding -> faster_eth_abi/encoding.py)
|
21
|
+
submoduleFile = "unknown"
|
22
|
+
benchmarkFile = "unknown"
|
23
|
+
m = None
|
24
|
+
if submodule.startswith("faster_eth_abi."):
|
25
|
+
m = submodule[len("faster_eth_abi.") :]
|
26
|
+
|
27
|
+
if m:
|
28
|
+
submoduleFile = f"faster_eth_abi/{m}.py"
|
29
|
+
benchmarkFile = f"benchmarks/test_{m}_benchmarks.py"
|
30
|
+
|
31
|
+
submoduleUrl = f"https://github.com/{repo}/blob/{branch}/{submoduleFile}"
|
32
|
+
benchmarkUrl = f"https://github.com/{repo}/blob/{branch}/{benchmarkFile}"
|
33
|
+
|
34
|
+
md_lines = []
|
35
|
+
md_lines.append(
|
36
|
+
f"#### [{submodule}]({submoduleUrl}) - [view benchmarks]({benchmarkUrl})\n"
|
37
|
+
)
|
38
|
+
md_lines.append(
|
39
|
+
"| Function | Reference Mean | Faster Mean | % Change | Speedup (%) | x Faster | Faster |"
|
40
|
+
)
|
41
|
+
md_lines.append(
|
42
|
+
"|----------|---------------|-------------|----------|-------------|----------|--------|"
|
43
|
+
)
|
44
|
+
|
45
|
+
for group, data in sorted(groupDiffs.items()):
|
46
|
+
if data.get("percent_change") is not None:
|
47
|
+
emoji = "➖"
|
48
|
+
if data["percent_change"] > 0:
|
49
|
+
emoji = "✅"
|
50
|
+
elif data["percent_change"] < 0:
|
51
|
+
emoji = "❌"
|
52
|
+
percentChange = (
|
53
|
+
f"{data['percent_change']:.2f}%"
|
54
|
+
if data.get("percent_change") is not None
|
55
|
+
else ""
|
56
|
+
)
|
57
|
+
speedupPercent = (
|
58
|
+
f"{data['speedup_percent']:.2f}%"
|
59
|
+
if data.get("speedup_percent") is not None
|
60
|
+
else ""
|
61
|
+
)
|
62
|
+
speedupX = (
|
63
|
+
f"{data['speedup_x']:.2f}x"
|
64
|
+
if data.get("speedup_x") is not None
|
65
|
+
and isinstance(data["speedup_x"], (int, float))
|
66
|
+
else ""
|
67
|
+
)
|
68
|
+
md_lines.append(
|
69
|
+
f"| `{group}` | {data.get('reference_mean', '')} | {data.get('faster_mean', '')} | {percentChange} | {speedupPercent} | {speedupX} | {emoji} |"
|
70
|
+
)
|
71
|
+
elif data.get("note"):
|
72
|
+
md_lines.append(f"| `{group}` | | | | | | ➖ |")
|
73
|
+
|
74
|
+
md_lines.append("") # Blank line at end
|
75
|
+
md_content = "\n".join(md_lines)
|
76
|
+
|
77
|
+
# Write to file
|
78
|
+
module_name = submodule.split(".")[-1]
|
79
|
+
out_path = os.path.join(results_dir, f"{module_name}.md")
|
80
|
+
with open(out_path, "w", encoding="utf-8") as outf:
|
81
|
+
outf.write(md_content)
|
82
|
+
|
83
|
+
|
84
|
+
if __name__ == "__main__":
|
85
|
+
main()
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"""
|
2
|
+
parse_benchmark_output.py
|
3
|
+
|
4
|
+
Extracts per-function benchmark timings from pytest-benchmark's benchmark.json output.
|
5
|
+
Parses the JSON file, finds all test function results, and writes a JSON file
|
6
|
+
mapping submodules (e.g., Python submodules like faster_eth_abi.encoding) to groups and their test functions and results.
|
7
|
+
|
8
|
+
Usage:
|
9
|
+
python parse_benchmark_output.py <benchmark.json> [output.json]
|
10
|
+
"""
|
11
|
+
|
12
|
+
from collections import (
|
13
|
+
defaultdict,
|
14
|
+
)
|
15
|
+
import json
|
16
|
+
import re
|
17
|
+
import sys
|
18
|
+
from typing import (
|
19
|
+
Any,
|
20
|
+
Dict,
|
21
|
+
)
|
22
|
+
|
23
|
+
|
24
|
+
def get_submodule(bench: dict) -> str:
|
25
|
+
# Extract Python submodule from fullname, e.g., "benchmarks/test_abi_benchmarks.py::test_abi_to_signature"
|
26
|
+
fullname = bench.get("fullname", "")
|
27
|
+
# Try to extract the submodule from the test file path
|
28
|
+
m = re.search(r"benchmarks/test_([a-zA-Z0-9_]+)_benchmarks\.py", fullname)
|
29
|
+
if m:
|
30
|
+
return f"faster_eth_abi.{m.group(1)}"
|
31
|
+
return "unknown"
|
32
|
+
|
33
|
+
|
34
|
+
def get_group_name(test_name: str) -> str:
|
35
|
+
# Extract group from test name, e.g., test_foo, test_faster_foo -> group: foo
|
36
|
+
m = re.match(r"test_faster_(.+)", test_name)
|
37
|
+
if m:
|
38
|
+
return m.group(1)
|
39
|
+
m = re.match(r"test_(.+)", test_name)
|
40
|
+
if m:
|
41
|
+
return m.group(1)
|
42
|
+
return test_name
|
43
|
+
|
44
|
+
|
45
|
+
def parse_pytest_benchmark_json(data: dict) -> Dict[str, Dict[str, Dict[str, Any]]]:
|
46
|
+
"""
|
47
|
+
Parses pytest-benchmark's benchmark.json and extracts per-function timings,
|
48
|
+
grouped by submodule and group name.
|
49
|
+
Returns a dict: {submodule: {group: {function_name: {...}}}}
|
50
|
+
"""
|
51
|
+
results = defaultdict(lambda: defaultdict(dict))
|
52
|
+
for bench in data.get("benchmarks", []):
|
53
|
+
name = bench["name"]
|
54
|
+
submodule = get_submodule(bench)
|
55
|
+
group = get_group_name(name)
|
56
|
+
stats = bench["stats"]
|
57
|
+
results[submodule][group][name] = {
|
58
|
+
"mean": stats.get("mean"),
|
59
|
+
"stddev": stats.get("stddev", None),
|
60
|
+
"iqr": stats.get("iqr", None),
|
61
|
+
"min": stats.get("min", None),
|
62
|
+
"max": stats.get("max", None),
|
63
|
+
"rounds": stats.get("rounds", None),
|
64
|
+
}
|
65
|
+
return results
|
66
|
+
|
67
|
+
|
68
|
+
def main() -> None:
|
69
|
+
if len(sys.argv) < 2:
|
70
|
+
print("Usage: python parse_benchmark_output.py <benchmark.json> [output.json]")
|
71
|
+
sys.exit(1)
|
72
|
+
infile = sys.argv[1]
|
73
|
+
outfile = sys.argv[2] if len(sys.argv) > 2 else "benchmark_results.json"
|
74
|
+
with open(infile) as f:
|
75
|
+
data = json.load(f)
|
76
|
+
results = parse_pytest_benchmark_json(data)
|
77
|
+
with open(outfile, "w") as f:
|
78
|
+
json.dump(results, f, indent=2)
|
79
|
+
print(f"Parsed results written to {outfile}")
|
80
|
+
|
81
|
+
|
82
|
+
if __name__ == "__main__":
|
83
|
+
main()
|
@@ -16,6 +16,8 @@ extras_require = {
|
|
16
16
|
"tox>=4.0.0",
|
17
17
|
"twine",
|
18
18
|
"wheel",
|
19
|
+
"pytest-codspeed",
|
20
|
+
"pytest-benchmark",
|
19
21
|
],
|
20
22
|
"docs": [
|
21
23
|
"sphinx>=6.0.0",
|
@@ -74,8 +76,8 @@ else:
|
|
74
76
|
setup(
|
75
77
|
name="faster_eth_abi",
|
76
78
|
# *IMPORTANT*: Don't manually change the version here. See Contributing docs for the release process.
|
77
|
-
version="5.2.
|
78
|
-
description="""A fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
|
79
|
+
version="5.2.6",
|
80
|
+
description="""A aster fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding. Implemented in C.""",
|
79
81
|
long_description=long_description,
|
80
82
|
long_description_content_type="text/markdown",
|
81
83
|
author="The Ethereum Foundation",
|
@@ -110,6 +112,7 @@ setup(
|
|
110
112
|
"Programming Language :: Python :: 3.11",
|
111
113
|
"Programming Language :: Python :: 3.12",
|
112
114
|
"Programming Language :: Python :: 3.13",
|
115
|
+
"Programming Language :: Python :: 3.14",
|
113
116
|
"Programming Language :: Python :: Implementation :: CPython",
|
114
117
|
],
|
115
118
|
)
|
faster_eth_abi-5.2.5/README.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# Ethereum Contract Interface (ABI) Utility
|
2
|
-
|
3
|
-
[](https://discord.gg/GHryRvPB84)
|
4
|
-
[](https://circleci.com/gh/ethereum/faster-eth-abi)
|
5
|
-
[](https://badge.fury.io/py/faster-eth-abi)
|
6
|
-
[](https://pypi.python.org/pypi/faster-eth-abi)
|
7
|
-
[](https://faster-eth-abi.readthedocs.io/en/latest/?badge=latest)
|
8
|
-
|
9
|
-
Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
|
10
|
-
|
11
|
-
Read the [documentation](https://faster-eth-abi.readthedocs.io/).
|
12
|
-
|
13
|
-
View the [change log](https://faster-eth-abi.readthedocs.io/en/latest/release_notes.html).
|
14
|
-
|
15
|
-
## Installation
|
16
|
-
|
17
|
-
```sh
|
18
|
-
python -m pip install faster-eth-abi
|
19
|
-
```
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_is_encodable_type.py
RENAMED
File without changes
|
{faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/abi_tests/test_reversibility_properties.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/decoding/test_context_frames_bytes_io.py
RENAMED
File without changes
|
{faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/decoding/test_decoder_properties.py
RENAMED
File without changes
|
File without changes
|
{faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/encoding/test_encoder_properties.py
RENAMED
File without changes
|
File without changes
|
{faster_eth_abi-5.2.5 → faster_eth_abi-5.2.6}/tests/core/end_to_end/test_custom_registrations.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|