File tree 10 files changed +315
-88
lines changed
10 files changed +315
-88
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ concurrency:
15
15
cancel-in-progress : true
16
16
17
17
env :
18
+ PYTHON_VERSION : ' 3.13'
18
19
COINCURVE_IGNORE_SYSTEM_LIB : ' ON'
19
20
COINCURVE_SECP256K1_STATIC : ' ON'
20
21
COINCURVE_CROSS_HOST : ' '
23
24
COINCURVE_SECP256K1_STATIC
24
25
COINCURVE_CROSS_HOST
25
26
CIBW_BEFORE_ALL_MACOS : ./.github/scripts/install-macos-build-deps.sh
26
- CIBW_TEST_REQUIRES : pytest pytest-benchmark
27
+ CIBW_TEST_REQUIRES : pytest
27
28
CIBW_TEST_COMMAND : >
28
29
python -c
29
30
"from coincurve import PrivateKey;
79
80
name : coverage-${{ matrix.os }}-${{ matrix.python-version }}
80
81
path : coverage.xml
81
82
82
- - name : Run benchmarks
83
- run : hatch run hatch-test.py${{ matrix.python-version }}:bench
83
+ - name : Install uv
84
+ uses : astral-sh/setup-uv@v5
85
+
86
+ - name : Benchmark
87
+ run : uv run --python-preference system scripts/bench.py
84
88
85
89
coverage :
86
90
name : Upload coverage
@@ -172,7 +176,7 @@ jobs:
172
176
173
177
- uses : actions/setup-python@v5
174
178
with :
175
- python-version : ' 3.12 '
179
+ python-version : ${{ env.PYTHON_VERSION }}
176
180
177
181
- name : Build wheels
178
182
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ concurrency:
15
15
cancel-in-progress : true
16
16
17
17
env :
18
+ PYTHON_VERSION : ' 3.12'
18
19
COINCURVE_UPSTREAM_REF : __no_upstream__
19
20
COINCURVE_IGNORE_SYSTEM_LIB : ' OFF'
20
21
COINCURVE_SECP256K1_STATIC : ' OFF'
25
26
COINCURVE_SECP256K1_STATIC
26
27
COINCURVE_CROSS_HOST
27
28
CIBW_BEFORE_ALL_MACOS : ./.github/scripts/install-macos-build-deps.sh
28
- CIBW_TEST_REQUIRES : pytest pytest-benchmark
29
+ CIBW_TEST_REQUIRES : pytest
29
30
CIBW_TEST_COMMAND : >
30
31
python -c
31
32
"from coincurve import PrivateKey;
44
45
defaults :
45
46
run :
46
47
shell : bash -el {0}
47
- env :
48
- PYTHON_VERSION : ' 3.12'
49
48
50
49
steps :
51
50
- uses : actions/checkout@v4
70
69
- name : Run tests
71
70
run : LD_LIBRARY_PATH=$CONDA_PREFIX/lib hatch test
72
71
73
- - name : Run benchmarks
74
- run : hatch run hatch-test.py${{ env.PYTHON_VERSION }}:bench
72
+ - name : Install uv
73
+ uses : astral-sh/setup-uv@v5
74
+
75
+ - name : Benchmark
76
+ run : LD_LIBRARY_PATH=$CONDA_PREFIX/lib uv run --python-preference system scripts/bench.py
75
77
76
78
linux-wheels-standard :
77
79
name : Build Linux wheels
81
83
defaults :
82
84
run :
83
85
shell : bash -el {0}
84
- env :
85
- PYTHON_VERSION : ' 3.12'
86
86
87
87
steps :
88
88
- uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -15,14 +15,15 @@ concurrency:
15
15
cancel-in-progress : true
16
16
17
17
env :
18
+ PYTHON_VERSION : ' 3.12'
18
19
COINCURVE_IGNORE_SYSTEM_LIB : ' 1'
19
20
# Only 'SHARED' is recognized, any other string means 'not SHARED'
20
21
COINCURVE_SECP256K1_BUILD : ' SHARED'
21
22
CIBW_ENVIRONMENT_PASS_LINUX : >
22
23
COINCURVE_IGNORE_SYSTEM_LIB
23
24
COINCURVE_SECP256K1_BUILD
24
25
CIBW_BEFORE_ALL_MACOS : ./.github/scripts/install-macos-build-deps.sh
25
- CIBW_TEST_REQUIRES : pytest pytest-benchmark
26
+ CIBW_TEST_REQUIRES : pytest
26
27
CIBW_TEST_COMMAND : >
27
28
python -c
28
29
"from coincurve import PrivateKey;
40
41
name : Test latest Python
41
42
runs-on : ubuntu-latest
42
43
43
- env :
44
- PYTHON_VERSION : ' 3.12'
45
-
46
44
steps :
47
45
- uses : actions/checkout@v4
48
46
67
65
- name : Run tests
68
66
run : hatch test
69
67
70
- - name : Run benchmarks
71
- run : hatch run hatch-test.py${{ env.PYTHON_VERSION }}:bench
68
+ - name : Install uv
69
+ uses : astral-sh/setup-uv@v5
70
+
71
+ - name : Benchmark
72
+ run : uv run --python-preference system scripts/bench.py
72
73
73
74
linux-wheels-standard :
74
75
name : Build Linux wheels
@@ -119,7 +120,7 @@ jobs:
119
120
120
121
- uses : actions/setup-python@v5
121
122
with :
122
- python-version : ' 3.12 '
123
+ python-version : ${{ env.PYTHON_VERSION }}
123
124
124
125
- name : Build wheels
125
126
Original file line number Diff line number Diff line change
1
+ # Benchmarks
2
+
3
+ -----
4
+
5
+ ## Setup
6
+
7
+ Download [ Hatch] ( https://hatch.pypa.io/latest/install/ ) or [ UV] ( https://docs.astral.sh/uv/getting-started/installation/ ) in order to run the benchmarks as follows:
8
+
9
+ ```
10
+ [hatch|uv] run scripts/bench.py
11
+ ```
12
+
13
+ ## Results
14
+
15
+ | Library | Key generation | Signing | Verification | Key export | Key import |
16
+ | --- | --- | --- | --- | --- | --- |
17
+ | coincurve v20.0.0 | 33.4 | 52.8 | 58.4 | 12.6 | 39.4 |
18
+ | [ fastecdsa] ( https://github.com/AntonKueltz/fastecdsa ) v3.0.1 | 1319.6 | 1449.5 | 1160.4 | 1402.9 | 15.5 |
19
+
20
+ !!! note
21
+ - the timings are in microseconds
22
+ - signing and verification use a 16 KiB message
23
+ - the Python version used for the benchmarks is 3.13.x
Original file line number Diff line number Diff line change @@ -8,15 +8,6 @@ dependencies = ["ruff==0.9.9"]
8
8
9
9
[envs .hatch-test ]
10
10
dev-mode = false
11
- extra-dependencies = [
12
- " pytest-benchmark" ,
13
- ]
14
- [envs .hatch-test .scripts ]
15
- run = " pytest{env:HATCH_TEST_ARGS:} --benchmark-skip {args}"
16
- run-cov = " coverage run -m pytest{env:HATCH_TEST_ARGS:} --benchmark-skip {args}"
17
- cov-combine = " coverage combine"
18
- cov-report = " coverage report"
19
- bench = " pytest{env:HATCH_TEST_ARGS:} --benchmark-only --benchmark-sort=name --benchmark-cprofile=tottime {args}"
20
11
21
12
[envs .types ]
22
13
dependencies = [
Original file line number Diff line number Diff line change 48
48
- About : index.md
49
49
- Install : install.md
50
50
- API Reference : api.md
51
+ - Benchmarks : benchmarks.md
51
52
- Meta :
52
53
- Users : users.md
53
54
- History : history.md
Original file line number Diff line number Diff line change @@ -13,14 +13,16 @@ name = "coincurve"
13
13
authors = [
14
14
{
name =
" Ofek Lev" ,
email =
" [email protected] " },
15
15
]
16
- description = " Cross-platform Python bindings for libsecp256k1 "
16
+ description = " Safest and fastest Python library for secp256k1 elliptic curve operations "
17
17
keywords = [
18
18
" bitcoin" ,
19
19
" crypto" ,
20
20
" cryptocurrency" ,
21
+ " ecdh" ,
21
22
" ecdsa" ,
22
23
" elliptic curves" ,
23
24
" ethereum" ,
25
+ " libsecp256k1" ,
24
26
" secp256k1" ,
25
27
" schnorr" ,
26
28
]
Original file line number Diff line number Diff line change
1
+ # Scripts
2
+
3
+ -----
4
+
5
+ This directory contains scripts that are used to develop the project.
You can’t perform that action at this time.
0 commit comments