Avatar for the Bluetooth-Devices user
Bluetooth-Devices
bluetooth-data-tools
BlogDocsChangelog

perf(distance): replace min() with inline ternary in calculate_distance_meters

#276Merged
Comparing
bluetoothbot:koan/distance-min-ternary
(
d6f1312
) with
main
(
7c2a1e2
)
CodSpeed Performance Gauge
+7%
Improvement
1
Untouched
34

Benchmarks

35 total
test_calculate_distance_meters_far
tests/benchmarks/test_calculate_distance_meters.py
CodSpeed Performance Gauge
+7%
18.9 µs17.6 µs
test_calculate_distance_meters_close
tests/benchmarks/test_calculate_distance_meters.py
CodSpeed Performance Gauge
+10%
19.7 µs17.9 µs
test_uint128_bytes_as_uuid_cached
tests/benchmarks/test_uint128_bytes_as_uuid.py
CodSpeed Performance Gauge
+2%
13.6 µs13.4 µs
test_uint16_int_as_uuid_cached
tests/benchmarks/test_uint16_int_as_uuid.py
CodSpeed Performance Gauge
+1%
12.1 µs12 µs
test_newest_manufacturer_data_single
tests/benchmarks/test_newest_manufacturer_data.py
CodSpeed Performance Gauge
+1%
16.3 µs16.1 µs
test_human_readable_name_with_name
tests/benchmarks/test_human_readable_name.py
CodSpeed Performance Gauge
+1%
14.6 µs14.4 µs
test_parse_advertisement_128bit_uuid_list
tests/benchmarks/test_parse_gap_uuid_lists.py
CodSpeed Performance Gauge
+1%
20.5 µs20.3 µs
test_manufacturer_data_to_raw_long
tests/benchmarks/test_manufacturer_data_to_raw.py
CodSpeed Performance Gauge
+1%
16.1 µs15.9 µs
test_parse_int_to_bluetooth_address_uncached
tests/benchmarks/test_int_to_bluetooth_address.py
CodSpeed Performance Gauge
+1%
11.8 µs11.7 µs
test_parse_advertisement_data_tuple
tests/benchmarks/test_parse_gap_tuple.py
CodSpeed Performance Gauge
+1%
15.5 µs15.4 µs
test_uint128_bytes_as_uuid_uncached
tests/benchmarks/test_uint128_bytes_as_uuid.py
CodSpeed Performance Gauge
+1%
27.2 µs27 µs
test_parse_advertisement_data
tests/benchmarks/test_parse_gap.py
CodSpeed Performance Gauge
+1%
31.8 µs31.5 µs
test_manufacturer_data_to_raw_short
tests/benchmarks/test_manufacturer_data_to_raw.py
CodSpeed Performance Gauge
+1%
15.9 µs15.8 µs
test_uint32_int_as_uuid_cached
tests/benchmarks/test_uint32_int_as_uuid.py
CodSpeed Performance Gauge
+1%
11.9 µs11.9 µs
test_parse_advertisement_data_tuple
tests/benchmarks/test_parse_gap.py
CodSpeed Performance Gauge
+1%
16.7 µs16.6 µs
test_human_readable_name_local_only
tests/benchmarks/test_human_readable_name.py
CodSpeed Performance Gauge
+1%
14.8 µs14.7 µs
test_parse_advertisement_data_bytes
tests/benchmarks/test_parse_gap_bytes.py
CodSpeed Performance Gauge
+1%
15.2 µs15.1 µs
test_parse_advertisement_data_tuple_uncached
tests/benchmarks/test_parse_gap_tuple.py
CodSpeed Performance Gauge
0%
19.1 µs19 µs
test_mac_to_int_uncached
tests/benchmarks/test_mac_to_int.py
CodSpeed Performance Gauge
0%
13 µs12.9 µs
test_newest_manufacturer_data_multi
tests/benchmarks/test_newest_manufacturer_data.py
CodSpeed Performance Gauge
0%
16 µs15.9 µs
test_calculate_distance_meters_zero
tests/benchmarks/test_calculate_distance_meters.py
CodSpeed Performance Gauge
0%
11.3 µs11.3 µs
test_parse_int_to_bluetooth_address_cached
tests/benchmarks/test_int_to_bluetooth_address.py
CodSpeed Performance Gauge
0%
11.9 µs11.9 µs
test_short_address_colon
tests/benchmarks/test_short_address.py
CodSpeed Performance Gauge
0%
19.7 µs19.7 µs
test_resolve_private_address_mismatch
tests/benchmarks/test_resolve_private_address.py
CodSpeed Performance Gauge
0%
88.4 µs88.4 µs
test_mac_to_int_cached
tests/benchmarks/test_mac_to_int.py
CodSpeed Performance Gauge
0%
11.7 µs11.7 µs

Commits

Click on a commit to change the comparison range
Base
main
7c2a1e2
+7.22%
perf(distance): replace min() with inline ternary
d6f1312
13 days ago
by bluetoothbot
© 2026 CodSpeed Technology
Home Terms Privacy Docs