Skip to content

Commit 2fa40df

Browse files
Updating map import time estimates.
1 parent 0ac1e55 commit 2fa40df

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

modules/map/lib.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -222,34 +222,27 @@ def get_import_status(session: Session = None) -> List[MapFile]:
222222

223223

224224
# Calculated using many tests on a well-cooled RPi4 (4GB).
225-
RPI4_PBF_BYTES_PER_SECOND = 61879
226-
RPI4_A = 7.17509261732342e-14
227-
RPI4_B = 6.6590760410412e-5
228-
RPI4_C = 10283
225+
RPI4_PBF_BYTES_PER_SECOND = 175473
226+
RPI4_COEFFICIENTS = [4.01229956e-15, 7.19038150e-06, -1.36868043e+02]
229227
# Calculated using many tests on a well-cooled RPi5 (8GB).
230228
RPI5_PBF_BYTES_PER_SECOND = 136003
231-
RPI5_A = 1.6681382703586e-15
232-
RPI5_B = 2.35907824676145e-6
233-
RPI5_C = 53.727
229+
RPI_5COEFFICIENTS = [1.66813827e-15, 2.35907825e-06, 5.37276181e+01]
234230

235231

236232
def seconds_to_import_rpi4(size_in_bytes: int) -> int:
237233
if size_in_bytes > 1_000_000_000:
238234
# Use exponential curve for large files.
239-
a = RPI4_A * size_in_bytes ** 2
240-
b = RPI4_B * size_in_bytes
241-
return int(a - b + RPI4_C)
235+
a, b, c = RPI4_COEFFICIENTS
236+
return int(a * size_in_bytes ** 2 + b * size_in_bytes + c)
242237
# Use simpler equation for small files.
243238
return max(int(size_in_bytes // RPI4_PBF_BYTES_PER_SECOND), 0)
244239

245240

246241
def seconds_to_import_rpi5(size_in_bytes: int) -> int:
247-
if size_in_bytes > 5_000_000_000:
242+
if size_in_bytes > 1_000_000_000:
248243
# Use exponential curve for large files.
249-
a = RPI5_A * size_in_bytes ** 2
250-
b = RPI5_B * size_in_bytes
251-
return int(a - b + RPI5_C)
252-
# Use simpler equation for small files.
244+
a, b, c = RPI_5COEFFICIENTS
245+
return int(a * size_in_bytes ** 2 + b * size_in_bytes + c)
253246
return max(int(size_in_bytes // RPI5_PBF_BYTES_PER_SECOND), 0)
254247

255248

modules/map/test/test_lib.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ async def test_run_import_command(test_directory, mock_run_command, run_command_
6969
@pytest.mark.parametrize('size,expected', [
7070
(0, 0),
7171
(-1, 0),
72-
(17737381, 286),
73-
(63434267, 1025),
74-
(87745484, 1418),
75-
(116318111, 1879),
76-
(136372996, 2203),
77-
(1936075318, 150308),
78-
(2676094489, 345922),
79-
(3392375001, 610106),
80-
(11346305075, 8491840),
72+
(17737381, 101),
73+
(63434267, 361),
74+
(87745484, 500),
75+
(116318111, 662),
76+
(136372996, 777),
77+
(1936075318, 28823),
78+
(2676094489, 47839),
79+
(3392375001, 70429),
80+
(11346305075, 597985),
8181
])
8282
def test_seconds_to_import_rpi4(size, expected):
8383
assert lib.seconds_to_import(size) == expected
@@ -91,10 +91,10 @@ def test_seconds_to_import_rpi4(size, expected):
9191
(87745484, 645),
9292
(116318111, 855),
9393
(136372996, 1002),
94-
(1936075318, 14235),
95-
(2676094489, 19676),
96-
(3392375001, 24943),
97-
(11346305075, 188040),
94+
(1936075318, 10873),
95+
(2676094489, 18313),
96+
(3392375001, 27253),
97+
(11346305075, 241574),
9898
])
9999
def test_seconds_to_import_rpi5(size, expected):
100100
assert lib.seconds_to_import(size, True) == expected

0 commit comments

Comments
 (0)