Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-use priority queue in StaticRTree #6952

Merged
merged 4 commits into from
Jun 25, 2024

Conversation

SiarheiFedartsou
Copy link
Member

@SiarheiFedartsou SiarheiFedartsou commented Jun 16, 2024

Gives slight performance boost, because we don't have allocations in PQ...

Benchmark Results

Benchmark Base PR
alias aliased u32: 1138.37
plain u32: 1147.21
aliased double: 1182.51
plain double: 1177.4
aliased u32: 1139.58
plain u32: 1146.7
aliased double: 1180
plain double: 1180.56
e2e_match_ch Ops: 45.54 ± 0.08 ops/s. Best: 45.44 ops/s
Total: 2876.63ms ± 5.03ms. Best: 2866.25ms
Min time: 2.22ms ± 0.03ms
Mean time: 21.96ms ± 0.04ms
Median time: 15.59ms ± 0.15ms
95th percentile: 72.49ms ± 0.46ms
99th percentile: 86.37ms ± 0.41ms
Max time: 92.40ms ± 0.89ms
Ops: 45.92 ± 0.05 ops/s. Best: 45.87 ops/s
Total: 2852.55ms ± 3.01ms. Best: 2848.39ms
Min time: 2.21ms ± 0.04ms
Mean time: 21.78ms ± 0.02ms
Median time: 15.41ms ± 0.08ms
95th percentile: 71.44ms ± 0.20ms
99th percentile: 85.63ms ± 0.35ms
Max time: 91.40ms ± 0.32ms
e2e_match_mld Ops: 62.57 ± 0.07 ops/s. Best: 62.42 ops/s
Total: 2093.53ms ± 2.95ms. Best: 2088.50ms
Min time: 1.81ms ± 0.03ms
Mean time: 15.98ms ± 0.02ms
Median time: 8.56ms ± 0.10ms
95th percentile: 53.41ms ± 0.34ms
99th percentile: 61.57ms ± 0.17ms
Max time: 71.59ms ± 0.32ms
Ops: 62.73 ± 0.07 ops/s. Best: 62.64 ops/s
Total: 2088.24ms ± 2.47ms. Best: 2083.35ms
Min time: 1.82ms ± 0.02ms
Mean time: 15.94ms ± 0.02ms
Median time: 8.52ms ± 0.05ms
95th percentile: 53.11ms ± 0.15ms
99th percentile: 61.29ms ± 0.33ms
Max time: 71.24ms ± 0.57ms
e2e_nearest_ch Ops: 808.28 ± 5.28 ops/s. Best: 795.49 ops/s
Total: 1237.19ms ± 8.38ms. Best: 1228.90ms
Min time: 1.06ms ± 0.01ms
Mean time: 1.24ms ± 0.01ms
Median time: 1.15ms ± 0.01ms
95th percentile: 1.64ms ± 0.01ms
99th percentile: 1.69ms ± 0.02ms
Max time: 4.42ms ± 2.68ms
Ops: 808.10 ± 4.31 ops/s. Best: 797.79 ops/s
Total: 1237.48ms ± 7.01ms. Best: 1231.17ms
Min time: 1.06ms ± 0.01ms
Mean time: 1.24ms ± 0.01ms
Median time: 1.15ms ± 0.01ms
95th percentile: 1.64ms ± 0.01ms
99th percentile: 1.69ms ± 0.01ms
Max time: 4.07ms ± 2.34ms
e2e_nearest_mld Ops: 798.94 ± 3.73 ops/s. Best: 790.94 ops/s
Total: 1251.53ms ± 5.98ms. Best: 1244.49ms
Min time: 1.07ms ± 0.00ms
Mean time: 1.25ms ± 0.01ms
Median time: 1.16ms ± 0.01ms
95th percentile: 1.65ms ± 0.01ms
99th percentile: 1.70ms ± 0.01ms
Max time: 4.10ms ± 2.37ms
Ops: 810.22 ± 5.80 ops/s. Best: 796.31 ops/s
Total: 1234.19ms ± 9.12ms. Best: 1225.97ms
Min time: 1.05ms ± 0.01ms
Mean time: 1.23ms ± 0.01ms
Median time: 1.15ms ± 0.01ms
95th percentile: 1.63ms ± 0.01ms
99th percentile: 1.68ms ± 0.01ms
Max time: 4.20ms ± 2.37ms
e2e_route_ch Ops: 348.33 ± 1.68 ops/s. Best: 344.53 ops/s
Total: 2870.57ms ± 14.28ms. Best: 2852.99ms
Min time: 1.29ms ± 0.01ms
Mean time: 2.87ms ± 0.01ms
Median time: 2.89ms ± 0.02ms
95th percentile: 3.78ms ± 0.03ms
99th percentile: 4.21ms ± 0.04ms
Max time: 6.61ms ± 1.78ms
Ops: 346.30 ± 0.89 ops/s. Best: 345.02 ops/s
Total: 2887.93ms ± 7.67ms. Best: 2875.99ms
Min time: 1.28ms ± 0.01ms
Mean time: 2.89ms ± 0.01ms
Median time: 2.91ms ± 0.01ms
95th percentile: 3.82ms ± 0.04ms
99th percentile: 4.21ms ± 0.06ms
Max time: 6.50ms ± 1.72ms
e2e_route_mld Ops: 291.67 ± 0.90 ops/s. Best: 289.54 ops/s
Total: 3428.51ms ± 11.27ms. Best: 3418.43ms
Min time: 1.27ms ± 0.02ms
Mean time: 3.43ms ± 0.01ms
Median time: 3.47ms ± 0.02ms
95th percentile: 4.65ms ± 0.01ms
99th percentile: 5.09ms ± 0.05ms
Max time: 7.51ms ± 1.46ms
Ops: 289.23 ± 0.79 ops/s. Best: 288.12 ops/s
Total: 3457.11ms ± 9.50ms. Best: 3440.72ms
Min time: 1.30ms ± 0.02ms
Mean time: 3.46ms ± 0.01ms
Median time: 3.50ms ± 0.01ms
95th percentile: 4.71ms ± 0.04ms
99th percentile: 5.18ms ± 0.05ms
Max time: 7.23ms ± 1.58ms
e2e_table_ch Ops: 313.54 ± 1.33 ops/s. Best: 310.86 ops/s
Total: 3189.46ms ± 12.83ms. Best: 3175.24ms
Min time: 1.65ms ± 0.02ms
Mean time: 3.19ms ± 0.01ms
Median time: 3.19ms ± 0.01ms
95th percentile: 4.39ms ± 0.03ms
99th percentile: 4.71ms ± 0.06ms
Max time: 7.20ms ± 2.34ms
Ops: 314.84 ± 0.99 ops/s. Best: 312.49 ops/s
Total: 3176.12ms ± 10.49ms. Best: 3163.89ms
Min time: 1.68ms ± 0.02ms
Mean time: 3.18ms ± 0.01ms
Median time: 3.17ms ± 0.01ms
95th percentile: 4.35ms ± 0.01ms
99th percentile: 4.70ms ± 0.06ms
Max time: 7.16ms ± 2.31ms
e2e_table_mld Ops: 110.61 ± 0.22 ops/s. Best: 110.20 ops/s
Total: 9041.10ms ± 18.58ms. Best: 9018.57ms
Min time: 3.67ms ± 0.03ms
Mean time: 9.04ms ± 0.02ms
Median time: 9.01ms ± 0.02ms
95th percentile: 13.79ms ± 0.06ms
99th percentile: 14.70ms ± 0.11ms
Max time: 17.01ms ± 1.40ms
Ops: 110.51 ± 0.17 ops/s. Best: 110.10 ops/s
Total: 9048.60ms ± 14.07ms. Best: 9033.62ms
Min time: 3.65ms ± 0.02ms
Mean time: 9.05ms ± 0.01ms
Median time: 9.03ms ± 0.03ms
95th percentile: 13.83ms ± 0.04ms
99th percentile: 14.77ms ± 0.02ms
Max time: 16.62ms ± 1.53ms
e2e_trip_ch Ops: 98.23 ± 0.28 ops/s. Best: 97.54 ops/s
Total: 10179.89ms ± 29.21ms. Best: 10153.17ms
Min time: 1.52ms ± 0.14ms
Mean time: 10.18ms ± 0.03ms
Median time: 9.66ms ± 0.04ms
95th percentile: 18.06ms ± 0.03ms
99th percentile: 19.41ms ± 0.10ms
Max time: 23.27ms ± 2.51ms
Ops: 98.05 ± 0.61 ops/s. Best: 96.54 ops/s
Total: 10200.02ms ± 63.44ms. Best: 10145.88ms
Min time: 1.52ms ± 0.15ms
Mean time: 10.20ms ± 0.06ms
Median time: 9.68ms ± 0.08ms
95th percentile: 18.16ms ± 0.19ms
99th percentile: 19.77ms ± 0.07ms
Max time: 21.77ms ± 0.89ms
e2e_trip_mld Ops: 58.95 ± 0.04 ops/s. Best: 58.91 ops/s
Total: 16961.94ms ± 13.08ms. Best: 16929.92ms
Min time: 1.56ms ± 0.19ms
Mean time: 16.96ms ± 0.01ms
Median time: 16.54ms ± 0.04ms
95th percentile: 27.81ms ± 0.06ms
99th percentile: 29.38ms ± 0.17ms
Max time: 31.30ms ± 0.34ms
Ops: 58.73 ± 0.05 ops/s. Best: 58.66 ops/s
Total: 17028.43ms ± 13.08ms. Best: 16999.59ms
Min time: 1.66ms ± 0.20ms
Mean time: 17.03ms ± 0.01ms
Median time: 16.59ms ± 0.03ms
95th percentile: 28.01ms ± 0.05ms
99th percentile: 29.80ms ± 0.08ms
Max time: 31.96ms ± 0.53ms
json-render String: 6.83732ms
Stringstream: 10.2285ms
Vector: 6.60284ms
String: 6.74548ms
Stringstream: 10.4877ms
Vector: 7.10659ms
match_ch Default radius:
4.60339ms/req at 82 coordinate
0.0561389ms/coordinate
Radius 10m:
16.1992ms/req at 82 coordinate
0.197551ms/coordinate
Default radius:
4.57027ms/req at 82 coordinate
0.055735ms/coordinate
Radius 10m:
15.9323ms/req at 82 coordinate
0.194296ms/coordinate
match_mld Default radius:
3.33234ms/req at 82 coordinate
0.0406383ms/coordinate
Radius 10m:
11.563ms/req at 82 coordinate
0.141012ms/coordinate
Default radius:
3.18202ms/req at 82 coordinate
0.0388052ms/coordinate
Radius 10m:
12.1316ms/req at 82 coordinate
0.147946ms/coordinate
osrm_contract Time: 94.34s Peak RAM: 195.88MB Time: 94.53s Peak RAM: 195.90MB
osrm_customize Time: 1.39s Peak RAM: 116.66MB Time: 1.33s Peak RAM: 116.80MB
osrm_extract Time: 11.91s Peak RAM: 409.95MB Time: 11.96s Peak RAM: 411.39MB
osrm_partition Time: 1.99s Peak RAM: 139.03MB Time: 1.99s Peak RAM: 134.10MB
packedvector random write:
std::vector 11190 ms
util::packed_vector 73919.9 ms
slowdown: 6.60588
random read:
std::vector 11115.7 ms
util::packed_vector 30600 ms
slowdown: 2.75286
random write:
std::vector 11242.8 ms
util::packed_vector 81998.9 ms
slowdown: 7.29345
random read:
std::vector 11103.3 ms
util::packed_vector 33758.1 ms
slowdown: 3.04037
random_match_ch 500 matches, default radius
ops: 220.16 ± 0.71 ops/s. best: 218.48ops/s.
total: 258.91 ± 0.84ms. best: 258.10ms.
avg: 4.54 ± 0.01ms
min: 0.15 ± 0.01ms
max: 25.77 ± 0.07ms
p99: 25.77 ± 0.07ms

500 matches, radius=10
ops: 63.50 ± 0.14 ops/s. best: 63.25ops/s.
total: 1007.93 ± 2.29ms. best: 1004.56ms.
avg: 15.75 ± 0.04ms
min: 0.16 ± 0.00ms
max: 251.54 ± 0.99ms
p99: 251.54 ± 0.99ms

500 matches, radius=20
ops: 15.08 ± 0.03 ops/s. best: 15.04ops/s.
total: 4309.28 ± 7.92ms. best: 4297.06ms.
avg: 66.30 ± 0.12ms
min: 0.32 ± 0.00ms
max: 1263.96 ± 5.91ms
p99: 1263.96 ± 5.91ms
500 matches, default radius
ops: 223.20 ± 0.75 ops/s. best: 221.48ops/s.
total: 255.37 ± 0.86ms. best: 254.50ms.
avg: 4.48 ± 0.02ms
min: 0.15 ± 0.01ms
max: 25.52 ± 0.06ms
p99: 25.52 ± 0.06ms

500 matches, radius=10
ops: 64.06 ± 0.05 ops/s. best: 63.99ops/s.
total: 999.00 ± 0.83ms. best: 997.27ms.
avg: 15.61 ± 0.01ms
min: 0.16 ± 0.00ms
max: 249.75 ± 0.69ms
p99: 249.75 ± 0.69ms

500 matches, radius=20
ops: 15.19 ± 0.03 ops/s. best: 15.14ops/s.
total: 4278.55 ± 7.12ms. best: 4270.46ms.
avg: 65.82 ± 0.11ms
min: 0.32 ± 0.00ms
max: 1259.97 ± 3.75ms
p99: 1259.97 ± 3.75ms
random_match_mld 500 matches, default radius
ops: 300.42 ± 1.47 ops/s. best: 296.95ops/s.
total: 189.74 ± 0.93ms. best: 188.84ms.
avg: 3.33 ± 0.02ms
min: 0.13 ± 0.01ms
max: 19.69 ± 0.02ms
p99: 19.69 ± 0.02ms

500 matches, radius=10
ops: 105.97 ± 0.15 ops/s. best: 105.73ops/s.
total: 603.97 ± 0.87ms. best: 602.38ms.
avg: 9.44 ± 0.01ms
min: 0.15 ± 0.00ms
max: 114.79 ± 0.41ms
p99: 114.79 ± 0.41ms

500 matches, radius=20
ops: 21.07 ± 0.07 ops/s. best: 20.96ops/s.
total: 3084.70 ± 9.97ms. best: 3071.66ms.
avg: 47.46 ± 0.15ms
min: 0.20 ± 0.00ms
max: 605.52 ± 2.00ms
p99: 605.52 ± 2.00ms
500 matches, default radius
ops: 302.23 ± 1.93 ops/s. best: 297.67ops/s.
total: 188.61 ± 1.21ms. best: 187.50ms.
avg: 3.31 ± 0.02ms
min: 0.13 ± 0.00ms
max: 19.56 ± 0.07ms
p99: 19.56 ± 0.07ms

500 matches, radius=10
ops: 106.09 ± 0.07 ops/s. best: 106.00ops/s.
total: 603.26 ± 0.39ms. best: 602.66ms.
avg: 9.43 ± 0.01ms
min: 0.15 ± 0.00ms
max: 114.69 ± 0.42ms
p99: 114.69 ± 0.42ms

500 matches, radius=20
ops: 21.15 ± 0.04 ops/s. best: 21.10ops/s.
total: 3072.72 ± 6.52ms. best: 3062.96ms.
avg: 47.27 ± 0.10ms
min: 0.20 ± 0.00ms
max: 604.10 ± 2.62ms
p99: 604.10 ± 2.62ms
random_nearest_ch 10000 nearest, number_of_results=1
ops: 22602.79 ± 45.44 ops/s. best: 22486.25ops/s.
total: 442.43 ± 0.89ms. best: 441.76ms.
avg: 0.04 ± 0.00ms
min: 0.01 ± 0.00ms
max: 0.17 ± 0.04ms
p99: 0.11 ± 0.00ms

10000 nearest, number_of_results=5
ops: 17144.99 ± 10.85 ops/s. best: 17132.85ops/s.
total: 583.26 ± 0.37ms. best: 582.55ms.
avg: 0.06 ± 0.00ms
min: 0.02 ± 0.00ms
max: 0.15 ± 0.01ms
p99: 0.11 ± 0.00ms

10000 nearest, number_of_results=10
ops: 13906.74 ± 13.88 ops/s. best: 13878.53ops/s.
total: 719.08 ± 0.76ms. best: 718.09ms.
avg: 0.07 ± 0.00ms
min: 0.03 ± 0.00ms
max: 0.20 ± 0.04ms
p99: 0.13 ± 0.00ms
10000 nearest, number_of_results=1
ops: 23015.40 ± 51.77 ops/s. best: 22944.39ops/s.
total: 434.49 ± 0.98ms. best: 433.03ms.
avg: 0.04 ± 0.00ms
min: 0.01 ± 0.00ms
max: 0.17 ± 0.04ms
p99: 0.10 ± 0.00ms

10000 nearest, number_of_results=5
ops: 17397.11 ± 24.91 ops/s. best: 17338.50ops/s.
total: 574.81 ± 0.83ms. best: 573.94ms.
avg: 0.06 ± 0.00ms
min: 0.02 ± 0.00ms
max: 0.15 ± 0.00ms
p99: 0.11 ± 0.00ms

10000 nearest, number_of_results=10
ops: 14037.66 ± 23.90 ops/s. best: 13996.29ops/s.
total: 712.37 ± 1.21ms. best: 711.14ms.
avg: 0.07 ± 0.00ms
min: 0.03 ± 0.00ms
max: 0.18 ± 0.00ms
p99: 0.13 ± 0.00ms
random_nearest_mld 10000 nearest, number_of_results=1
ops: 22697.61 ± 52.97 ops/s. best: 22573.68ops/s.
total: 440.58 ± 1.03ms. best: 439.60ms.
avg: 0.04 ± 0.00ms
min: 0.01 ± 0.00ms
max: 0.17 ± 0.04ms
p99: 0.11 ± 0.00ms

10000 nearest, number_of_results=5
ops: 17166.64 ± 25.70 ops/s. best: 17128.19ops/s.
total: 582.53 ± 0.87ms. best: 581.24ms.
avg: 0.06 ± 0.00ms
min: 0.02 ± 0.00ms
max: 0.15 ± 0.00ms
p99: 0.11 ± 0.00ms

10000 nearest, number_of_results=10
ops: 13891.25 ± 17.53 ops/s. best: 13852.42ops/s.
total: 719.88 ± 0.92ms. best: 718.86ms.
avg: 0.07 ± 0.00ms
min: 0.03 ± 0.00ms
max: 0.18 ± 0.00ms
p99: 0.13 ± 0.00ms
10000 nearest, number_of_results=1
ops: 23232.01 ± 59.89 ops/s. best: 23086.13ops/s.
total: 430.44 ± 1.11ms. best: 429.52ms.
avg: 0.04 ± 0.00ms
min: 0.01 ± 0.00ms
max: 0.17 ± 0.04ms
p99: 0.10 ± 0.00ms

10000 nearest, number_of_results=5
ops: 17468.61 ± 16.80 ops/s. best: 17432.06ops/s.
total: 572.46 ± 0.55ms. best: 571.90ms.
avg: 0.06 ± 0.00ms
min: 0.02 ± 0.00ms
max: 0.15 ± 0.01ms
p99: 0.11 ± 0.00ms

10000 nearest, number_of_results=10
ops: 14089.80 ± 19.18 ops/s. best: 14054.67ops/s.
total: 709.73 ± 0.97ms. best: 708.22ms.
avg: 0.07 ± 0.00ms
min: 0.03 ± 0.00ms
max: 0.18 ± 0.00ms
p99: 0.13 ± 0.00ms
random_route_ch 1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
ops: 510.96 ± 2.07 ops/s. best: 508.31ops/s.
total: 1925.84 ± 7.78ms. best: 1913.93ms.
avg: 1.96 ± 0.01ms
min: 0.35 ± 0.00ms
max: 3.36 ± 0.13ms
p99: 2.85 ± 0.04ms

1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
ops: 598.80 ± 5.28 ops/s. best: 587.05ops/s.
total: 1670.19 ± 15.66ms. best: 1653.85ms.
avg: 1.67 ± 0.02ms
min: 0.06 ± 0.00ms
max: 3.96 ± 0.06ms
p99: 3.45 ± 0.04ms

1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
ops: 1012.87 ± 4.51 ops/s. best: 1003.79ops/s.
total: 971.53 ± 4.35ms. best: 966.18ms.
avg: 0.99 ± 0.00ms
min: 0.23 ± 0.00ms
max: 1.56 ± 0.03ms
p99: 1.37 ± 0.02ms

1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
ops: 1145.07 ± 6.47 ops/s. best: 1132.43ops/s.
total: 873.35 ± 4.95ms. best: 866.56ms.
avg: 0.87 ± 0.00ms
min: 0.04 ± 0.00ms
max: 2.95 ± 0.02ms
p99: 1.76 ± 0.03ms
1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
ops: 512.66 ± 1.27 ops/s. best: 511.18ops/s.
total: 1919.42 ± 4.76ms. best: 1912.64ms.
avg: 1.95 ± 0.00ms
min: 0.34 ± 0.00ms
max: 3.48 ± 0.16ms
p99: 2.85 ± 0.02ms

1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
ops: 604.08 ± 1.00 ops/s. best: 602.72ops/s.
total: 1655.43 ± 2.74ms. best: 1650.06ms.
avg: 1.66 ± 0.00ms
min: 0.05 ± 0.00ms
max: 3.88 ± 0.02ms
p99: 3.39 ± 0.01ms

1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
ops: 1035.47 ± 4.76 ops/s. best: 1028.05ops/s.
total: 950.32 ± 4.38ms. best: 945.76ms.
avg: 0.97 ± 0.00ms
min: 0.23 ± 0.00ms
max: 1.54 ± 0.02ms
p99: 1.34 ± 0.01ms

1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
ops: 1171.73 ± 5.30 ops/s. best: 1161.07ops/s.
total: 853.46 ± 3.87ms. best: 848.13ms.
avg: 0.85 ± 0.00ms
min: 0.04 ± 0.00ms
max: 2.96 ± 0.03ms
p99: 1.73 ± 0.02ms
random_route_mld 1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
ops: 250.55 ± 0.76 ops/s. best: 249.34ops/s.
total: 3927.42 ± 12.11ms. best: 3905.09ms.
avg: 3.99 ± 0.01ms
min: 0.35 ± 0.01ms
max: 8.55 ± 0.06ms
p99: 6.62 ± 0.07ms

1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
ops: 245.45 ± 0.24 ops/s. best: 244.93ops/s.
total: 4074.11 ± 4.02ms. best: 4069.75ms.
avg: 4.07 ± 0.00ms
min: 0.05 ± 0.00ms
max: 9.56 ± 0.70ms
p99: 8.14 ± 0.07ms

1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
ops: 333.77 ± 0.62 ops/s. best: 332.84ops/s.
total: 2948.19 ± 5.46ms. best: 2938.22ms.
avg: 3.00 ± 0.01ms
min: 0.30 ± 0.00ms
max: 7.32 ± 0.30ms
p99: 5.13 ± 0.05ms

1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
ops: 305.02 ± 1.65 ops/s. best: 301.39ops/s.
total: 3278.56 ± 17.85ms. best: 3257.82ms.
avg: 3.28 ± 0.02ms
min: 0.04 ± 0.00ms
max: 7.52 ± 0.36ms
p99: 6.40 ± 0.05ms
1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
ops: 251.67 ± 0.64 ops/s. best: 250.66ops/s.
total: 3909.85 ± 10.16ms. best: 3897.78ms.
avg: 3.97 ± 0.01ms
min: 0.34 ± 0.00ms
max: 8.69 ± 0.10ms
p99: 6.59 ± 0.04ms

1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
ops: 244.48 ± 0.22 ops/s. best: 244.17ops/s.
total: 4090.28 ± 3.69ms. best: 4083.71ms.
avg: 4.09 ± 0.00ms
min: 0.05 ± 0.00ms
max: 9.13 ± 0.27ms
p99: 8.14 ± 0.03ms

1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
ops: 334.94 ± 1.12 ops/s. best: 333.78ops/s.
total: 2937.91 ± 9.82ms. best: 2921.31ms.
avg: 2.99 ± 0.01ms
min: 0.29 ± 0.00ms
max: 7.29 ± 0.29ms
p99: 5.17 ± 0.03ms

1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
ops: 305.14 ± 0.63 ops/s. best: 303.95ops/s.
total: 3277.18 ± 6.81ms. best: 3268.38ms.
avg: 3.28 ± 0.01ms
min: 0.04 ± 0.00ms
max: 7.21 ± 0.12ms
p99: 6.37 ± 0.05ms
random_table_ch 250 tables, 3 coordinates
ops: 1509.87 ± 10.36 ops/s. best: 1486.46ops/s.
total: 165.59 ± 1.15ms. best: 164.59ms.
avg: 0.66 ± 0.00ms
min: 0.47 ± 0.00ms
max: 1.00 ± 0.26ms
p99: 0.82 ± 0.02ms

250 tables, 25 coordinates
ops: 178.10 ± 0.22 ops/s. best: 177.75ops/s.
total: 1403.69 ± 1.72ms. best: 1400.76ms.
avg: 5.61 ± 0.01ms
min: 5.06 ± 0.00ms
max: 6.45 ± 0.49ms
p99: 6.07 ± 0.04ms

250 tables, 50 coordinates
ops: 88.03 ± 0.11 ops/s. best: 87.89ops/s.
total: 2839.82 ± 3.45ms. best: 2833.05ms.
avg: 11.36 ± 0.01ms
min: 10.61 ± 0.03ms
max: 12.87 ± 0.89ms
p99: 12.06 ± 0.07ms
250 tables, 3 coordinates
ops: 1532.94 ± 11.79 ops/s. best: 1503.05ops/s.
total: 163.10 ± 1.27ms. best: 162.03ms.
avg: 0.65 ± 0.01ms
min: 0.46 ± 0.00ms
max: 0.99 ± 0.26ms
p99: 0.80 ± 0.02ms

250 tables, 25 coordinates
ops: 180.14 ± 0.15 ops/s. best: 179.94ops/s.
total: 1387.79 ± 1.14ms. best: 1386.13ms.
avg: 5.55 ± 0.00ms
min: 5.00 ± 0.01ms
max: 6.02 ± 0.02ms
p99: 5.96 ± 0.02ms

250 tables, 50 coordinates
ops: 88.70 ± 0.06 ops/s. best: 88.63ops/s.
total: 2818.42 ± 1.86ms. best: 2814.61ms.
avg: 11.27 ± 0.01ms
min: 10.51 ± 0.01ms
max: 12.37 ± 0.12ms
p99: 12.09 ± 0.05ms
random_table_mld 250 tables, 3 coordinates
ops: 344.83 ± 0.34 ops/s. best: 344.40ops/s.
total: 725.00 ± 0.71ms. best: 723.87ms.
avg: 2.90 ± 0.00ms
min: 2.29 ± 0.01ms
max: 3.96 ± 0.02ms
p99: 3.79 ± 0.03ms

250 tables, 25 coordinates
ops: 38.03 ± 0.19 ops/s. best: 37.57ops/s.
total: 6573.81 ± 33.46ms. best: 6543.40ms.
avg: 26.30 ± 0.13ms
min: 23.58 ± 0.07ms
max: 30.28 ± 0.54ms
p99: 29.10 ± 0.39ms

250 tables, 50 coordinates
ops: 17.88 ± 0.01 ops/s. best: 17.86ops/s.
total: 13982.81 ± 9.97ms. best: 13963.34ms.
avg: 55.93 ± 0.04ms
min: 51.89 ± 0.37ms
max: 61.82 ± 1.80ms
p99: 59.70 ± 0.21ms
250 tables, 3 coordinates
ops: 343.21 ± 0.83 ops/s. best: 341.27ops/s.
total: 728.43 ± 1.81ms. best: 726.74ms.
avg: 2.91 ± 0.01ms
min: 2.31 ± 0.00ms
max: 3.99 ± 0.00ms
p99: 3.81 ± 0.03ms

250 tables, 25 coordinates
ops: 38.04 ± 0.02 ops/s. best: 38.01ops/s.
total: 6571.81 ± 3.30ms. best: 6566.40ms.
avg: 26.29 ± 0.01ms
min: 23.62 ± 0.12ms
max: 29.79 ± 0.12ms
p99: 29.02 ± 0.11ms

250 tables, 50 coordinates
ops: 17.92 ± 0.02 ops/s. best: 17.87ops/s.
total: 13950.92 ± 17.31ms. best: 13937.62ms.
avg: 55.80 ± 0.07ms
min: 51.62 ± 0.09ms
max: 60.89 ± 0.87ms
p99: 59.88 ± 0.60ms
random_trip_ch 250 trips, 3 coordinates
ops: 484.00 ± 4.15 ops/s. best: 475.34ops/s.
total: 516.58 ± 4.46ms. best: 512.15ms.
avg: 2.07 ± 0.02ms
min: 1.06 ± 0.00ms
max: 2.97 ± 0.38ms
p99: 2.68 ± 0.10ms

250 trips, 5 coordinates
ops: 322.87 ± 1.81 ops/s. best: 319.00ops/s.
total: 774.34 ± 4.37ms. best: 770.44ms.
avg: 3.10 ± 0.02ms
min: 2.14 ± 0.02ms
max: 3.89 ± 0.16ms
p99: 3.76 ± 0.06ms
250 trips, 3 coordinates
ops: 487.22 ± 6.48 ops/s. best: 476.37ops/s.
total: 513.23 ± 6.60ms. best: 502.54ms.
avg: 2.05 ± 0.03ms
min: 1.07 ± 0.03ms
max: 2.98 ± 0.43ms
p99: 2.66 ± 0.07ms

250 trips, 5 coordinates
ops: 328.57 ± 0.70 ops/s. best: 327.64ops/s.
total: 760.87 ± 1.62ms. best: 757.55ms.
avg: 3.04 ± 0.01ms
min: 2.10 ± 0.02ms
max: 3.77 ± 0.03ms
p99: 3.68 ± 0.00ms
random_trip_mld 250 trips, 3 coordinates
ops: 172.51 ± 0.38 ops/s. best: 172.13ops/s.
total: 1449.18 ± 3.15ms. best: 1441.85ms.
avg: 5.80 ± 0.01ms
min: 3.87 ± 0.03ms
max: 7.70 ± 0.24ms
p99: 7.38 ± 0.06ms

250 trips, 5 coordinates
ops: 112.53 ± 0.25 ops/s. best: 112.17ops/s.
total: 2221.58 ± 4.94ms. best: 2213.57ms.
avg: 8.89 ± 0.02ms
min: 6.24 ± 0.04ms
max: 11.25 ± 0.21ms
p99: 10.72 ± 0.08ms
250 trips, 3 coordinates
ops: 171.03 ± 1.48 ops/s. best: 168.74ops/s.
total: 1461.90 ± 12.71ms. best: 1441.47ms.
avg: 5.85 ± 0.05ms
min: 3.85 ± 0.01ms
max: 8.01 ± 0.32ms
p99: 7.52 ± 0.12ms

250 trips, 5 coordinates
ops: 112.73 ± 0.12 ops/s. best: 112.53ops/s.
total: 2217.73 ± 2.29ms. best: 2214.00ms.
avg: 8.87 ± 0.01ms
min: 6.24 ± 0.04ms
max: 11.07 ± 0.11ms
p99: 10.62 ± 0.08ms
route_ch 1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
447.433ms
0.447433ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
542.011ms
0.542011ms/req
1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
163.526ms
0.163526ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
146.448ms
0.146448ms/req
1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
439.322ms
0.439322ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
536.387ms
0.536387ms/req
1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
159.533ms
0.159533ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
144.029ms
0.144029ms/req
route_mld 1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
588.304ms
0.588304ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
741.946ms
0.741946ms/req
1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
290.273ms
0.290273ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
314.739ms
0.314739ms/req
1000 routes, 3 coordinates, no alternatives, overview=full, steps=true
585.575ms
0.585575ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=full, steps=true
739.965ms
0.739965ms/req
1000 routes, 3 coordinates, no alternatives, overview=false, steps=false
285.697ms
0.285697ms/req
1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false
313.451ms
0.313451ms/req
rtree 1 result:
209.617ms -> 0.0209617 ms/query
10 results:
245.448ms -> 0.0245448 ms/query
1 result:
201.97ms -> 0.020197 ms/query
10 results:
237.127ms -> 0.0237127 ms/query

code = response.json()['code']
if code == 'NoSegment' or code == 'NoMatch':
continue
code = response.json()['code']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SiarheiFedartsou SiarheiFedartsou marked this pull request as ready for review June 16, 2024 12:02
// we use std::vector<QueryCandidate> with std::push_heap/std::pop_heap instead of
// std::priority_queue to be able to re-use allocated memory: std::priority_queue does not
// have `clear` method
static thread_local std::vector<QueryCandidate> traversal_queue;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK std::priority_queue is nothing more than wrapper around std::vector + std::push/pop_heap

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Priory queue sorts the elements. Deque is the one that's mostly an adapter over vector.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but std::priority_queue in its essence is std::vector with std::push_heap/std::pop_heap on top.

I.e. it means that when I do std::push_heap to vector we have a guarantee that very first element of vector will be a one with highest/lowest priority (of course if vector is valid heap before the call)

See:
https://stackoverflow.com/questions/11266360/when-should-i-use-make-heap-vs-priority-queue

Or https://en.cppreference.com/w/cpp/container/priority_queue:
Screenshot 2024-06-21 at 09 47 48

Or what exactly do you mean? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@DennisOSRM DennisOSRM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might break correctness

@DennisOSRM
Copy link
Collaborator

I think my main concern here is that with a priority queue the type itself already tells a lot about its usage.

Using a vector with the right heap functions gives equivalent functionality, but you have to understand the code (and the implementation of std::priority_queue) to know that there is a priority ordering.

I hope this makes more sense.

@SiarheiFedartsou
Copy link
Member Author

I think my main concern here is that with a priority queue the type itself already tells a lot about its usage.

Using a vector with the right heap functions gives equivalent functionality, but you have to understand the code (and the implementation of std::priority_queue) to know that there is a priority ordering.

I hope this makes more sense.

Okay, got it now, will it be okay for you if we would introduce our own PriorityQueue class (with proper tests etc)? According to my local tests (which are not that noisy as our CI benchmarks for now :) ) this is a quite good optimisation, so I would like to eventually somehow have it in master.

@SiarheiFedartsou SiarheiFedartsou force-pushed the sf-static-tree-prior-queue branch from 3070562 to a74fe05 Compare June 21, 2024 19:45
@SiarheiFedartsou
Copy link
Member Author

@DennisOSRM WDYT about updated implementation? 😀

Copy link
Collaborator

@DennisOSRM DennisOSRM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. It does capture the intent in a much better way.

@SiarheiFedartsou SiarheiFedartsou merged commit 0e17869 into master Jun 25, 2024
22 checks passed
@SiarheiFedartsou SiarheiFedartsou deleted the sf-static-tree-prior-queue branch June 25, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants