Skip to content

Commit 1ea72a9

Browse files
committed
update
1 parent 5096a8b commit 1ea72a9

File tree

3 files changed

+13
-25
lines changed

3 files changed

+13
-25
lines changed

.github/workflows/codspeed.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,19 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
23-
2423
- name: Setup Python
2524
uses: actions/setup-python@v5
2625
with:
2726
python-version: "3.12"
28-
27+
- name: Install dependencies
28+
run: pip install -r requirements.txt
2929
- name: Build Python package with maturin
3030
uses: PyO3/maturin-action@v1
3131
with:
3232
command: develop
3333
args: --release
34-
3534
- name: Install test dependencies
3635
run: pip install -r requirements.txt
37-
3836
- name: Run benchmarks
3937
uses: CodSpeedHQ/action@v4.5.2
4038
with:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ build:
66

77
.PHONY: format
88
format:
9-
ruff check --fix python/ tests/
109
ruff format python/ tests/
10+
ruff check --fix python/ tests/
1111
cargo fmt
1212

1313
.PHONY: lint

tests/test_benchmarks.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""CodSpeed benchmarks for uuid-utils"""
2+
23
import uuid
34

45
import pytest
5-
66
import uuid_utils
77

88
node = uuid.getnode()
@@ -11,100 +11,90 @@
1111
# UUID Generation Benchmarks
1212
@pytest.mark.benchmark
1313
def test_uuid1_stdlib(benchmark):
14-
"""Benchmark stdlib UUID v1 generation"""
1514
benchmark(lambda: uuid.uuid1(node))
1615

1716

1817
@pytest.mark.benchmark
1918
def test_uuid1_utils(benchmark):
20-
"""Benchmark uuid_utils UUID v1 generation"""
2119
benchmark(lambda: uuid_utils.uuid1(node))
2220

2321

2422
@pytest.mark.benchmark
2523
def test_uuid3_stdlib(benchmark):
26-
"""Benchmark stdlib UUID v3 generation"""
2724
benchmark(lambda: uuid.uuid3(namespace=uuid.NAMESPACE_DNS, name="python.org"))
2825

2926

3027
@pytest.mark.benchmark
3128
def test_uuid3_utils(benchmark):
32-
"""Benchmark uuid_utils UUID v3 generation"""
33-
benchmark(lambda: uuid_utils.uuid3(namespace=uuid_utils.NAMESPACE_DNS, name="python.org"))
29+
benchmark(
30+
lambda: uuid_utils.uuid3(namespace=uuid_utils.NAMESPACE_DNS, name="python.org")
31+
)
3432

3533

3634
@pytest.mark.benchmark
3735
def test_uuid4_stdlib(benchmark):
38-
"""Benchmark stdlib UUID v4 generation"""
3936
benchmark(lambda: uuid.uuid4())
4037

4138

4239
@pytest.mark.benchmark
4340
def test_uuid4_utils(benchmark):
44-
"""Benchmark uuid_utils UUID v4 generation"""
4541
benchmark(lambda: uuid_utils.uuid4())
4642

4743

4844
@pytest.mark.benchmark
4945
def test_uuid5_stdlib(benchmark):
50-
"""Benchmark stdlib UUID v5 generation"""
5146
benchmark(lambda: uuid.uuid5(namespace=uuid.NAMESPACE_DNS, name="python.org"))
5247

5348

5449
@pytest.mark.benchmark
5550
def test_uuid5_utils(benchmark):
56-
"""Benchmark uuid_utils UUID v5 generation"""
57-
benchmark(lambda: uuid_utils.uuid5(namespace=uuid_utils.NAMESPACE_DNS, name="python.org"))
51+
benchmark(
52+
lambda: uuid_utils.uuid5(namespace=uuid_utils.NAMESPACE_DNS, name="python.org")
53+
)
5854

5955

6056
# UUID Parsing Benchmarks
6157
@pytest.mark.benchmark
6258
def test_uuid_from_hex_stdlib(benchmark):
63-
"""Benchmark stdlib UUID from hex string"""
6459
benchmark(lambda: uuid.UUID("a8098c1a-f86e-11da-bd1a-00112444be1e"))
6560

6661

6762
@pytest.mark.benchmark
6863
def test_uuid_from_hex_utils(benchmark):
69-
"""Benchmark uuid_utils UUID from hex string"""
7064
benchmark(lambda: uuid_utils.UUID("a8098c1a-f86e-11da-bd1a-00112444be1e"))
7165

7266

7367
@pytest.mark.benchmark
7468
def test_uuid_from_bytes_stdlib(benchmark):
75-
"""Benchmark stdlib UUID from bytes"""
7669
hex_bytes = bytes.fromhex("a8098c1af86e11dabd1a00112444be1e")
7770
benchmark(lambda: uuid.UUID(bytes=hex_bytes))
7871

7972

8073
@pytest.mark.benchmark
8174
def test_uuid_from_bytes_utils(benchmark):
82-
"""Benchmark uuid_utils UUID from bytes"""
8375
hex_bytes = bytes.fromhex("a8098c1af86e11dabd1a00112444be1e")
8476
benchmark(lambda: uuid_utils.UUID(bytes=hex_bytes))
8577

8678

8779
@pytest.mark.benchmark
8880
def test_uuid_from_int_stdlib(benchmark):
89-
"""Benchmark stdlib UUID from int"""
9081
int_value = 223338299594506624080436508043913872926
9182
benchmark(lambda: uuid.UUID(int=int_value))
9283

9384

9485
@pytest.mark.benchmark
9586
def test_uuid_from_int_utils(benchmark):
96-
"""Benchmark uuid_utils UUID from int"""
9787
int_value = 223338299594506624080436508043913872926
9888
benchmark(lambda: uuid_utils.UUID(int=int_value))
9989

10090

10191
@pytest.mark.benchmark
10292
def test_uuid_from_fields_stdlib(benchmark):
103-
"""Benchmark stdlib UUID from fields"""
10493
benchmark(lambda: uuid.UUID(fields=(2819197978, 63598, 4570, 189, 26, 73622928926)))
10594

10695

10796
@pytest.mark.benchmark
10897
def test_uuid_from_fields_utils(benchmark):
109-
"""Benchmark uuid_utils UUID from fields"""
110-
benchmark(lambda: uuid_utils.UUID(fields=(2819197978, 63598, 4570, 189, 26, 73622928926)))
98+
benchmark(
99+
lambda: uuid_utils.UUID(fields=(2819197978, 63598, 4570, 189, 26, 73622928926))
100+
)

0 commit comments

Comments
 (0)