mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 17:36:18 -05:00
Updating map import time estimates.
This commit is contained in:
parent
0ac1e559bf
commit
f4fee874fb
2 changed files with 21 additions and 28 deletions
|
|
@ -222,34 +222,27 @@ def get_import_status(session: Session = None) -> List[MapFile]:
|
|||
|
||||
|
||||
# Calculated using many tests on a well-cooled RPi4 (4GB).
|
||||
RPI4_PBF_BYTES_PER_SECOND = 61879
|
||||
RPI4_A = 7.17509261732342e-14
|
||||
RPI4_B = 6.6590760410412e-5
|
||||
RPI4_C = 10283
|
||||
RPI4_PBF_BYTES_PER_SECOND = 175473
|
||||
RPI4_COEFFICIENTS = [4.01229956e-15, 7.19038150e-06, -1.36868043e+02]
|
||||
# Calculated using many tests on a well-cooled RPi5 (8GB).
|
||||
RPI5_PBF_BYTES_PER_SECOND = 136003
|
||||
RPI5_A = 1.6681382703586e-15
|
||||
RPI5_B = 2.35907824676145e-6
|
||||
RPI5_C = 53.727
|
||||
RPI5_COEFFICIENTS = [1.66813827e-15, 2.35907825e-06, 5.37276181e+01]
|
||||
|
||||
|
||||
def seconds_to_import_rpi4(size_in_bytes: int) -> int:
|
||||
if size_in_bytes > 1_000_000_000:
|
||||
# Use exponential curve for large files.
|
||||
a = RPI4_A * size_in_bytes ** 2
|
||||
b = RPI4_B * size_in_bytes
|
||||
return int(a - b + RPI4_C)
|
||||
a, b, c = RPI4_COEFFICIENTS
|
||||
return int(a * size_in_bytes ** 2 + b * size_in_bytes + c)
|
||||
# Use simpler equation for small files.
|
||||
return max(int(size_in_bytes // RPI4_PBF_BYTES_PER_SECOND), 0)
|
||||
|
||||
|
||||
def seconds_to_import_rpi5(size_in_bytes: int) -> int:
|
||||
if size_in_bytes > 5_000_000_000:
|
||||
if size_in_bytes > 1_000_000_000:
|
||||
# Use exponential curve for large files.
|
||||
a = RPI5_A * size_in_bytes ** 2
|
||||
b = RPI5_B * size_in_bytes
|
||||
return int(a - b + RPI5_C)
|
||||
# Use simpler equation for small files.
|
||||
a, b, c = RPI5_COEFFICIENTS
|
||||
return int(a * size_in_bytes ** 2 + b * size_in_bytes + c)
|
||||
return max(int(size_in_bytes // RPI5_PBF_BYTES_PER_SECOND), 0)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -69,15 +69,15 @@ async def test_run_import_command(test_directory, mock_run_command, run_command_
|
|||
@pytest.mark.parametrize('size,expected', [
|
||||
(0, 0),
|
||||
(-1, 0),
|
||||
(17737381, 286),
|
||||
(63434267, 1025),
|
||||
(87745484, 1418),
|
||||
(116318111, 1879),
|
||||
(136372996, 2203),
|
||||
(1936075318, 150308),
|
||||
(2676094489, 345922),
|
||||
(3392375001, 610106),
|
||||
(11346305075, 8491840),
|
||||
(17737381, 101),
|
||||
(63434267, 361),
|
||||
(87745484, 500),
|
||||
(116318111, 662),
|
||||
(136372996, 777),
|
||||
(1936075318, 28823),
|
||||
(2676094489, 47839),
|
||||
(3392375001, 70429),
|
||||
(11346305075, 597985),
|
||||
])
|
||||
def test_seconds_to_import_rpi4(size, expected):
|
||||
assert lib.seconds_to_import(size) == expected
|
||||
|
|
@ -91,10 +91,10 @@ def test_seconds_to_import_rpi4(size, expected):
|
|||
(87745484, 645),
|
||||
(116318111, 855),
|
||||
(136372996, 1002),
|
||||
(1936075318, 14235),
|
||||
(2676094489, 19676),
|
||||
(3392375001, 24943),
|
||||
(11346305075, 188040),
|
||||
(1936075318, 10873),
|
||||
(2676094489, 18313),
|
||||
(3392375001, 27253),
|
||||
(11346305075, 241574),
|
||||
])
|
||||
def test_seconds_to_import_rpi5(size, expected):
|
||||
assert lib.seconds_to_import(size, True) == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue