Skip to content

Commit 28d789a

Browse files
committed
chore: add benchmarks for remaining clustering algorithms
1 parent f498a05 commit 28d789a

1 file changed

Lines changed: 17 additions & 18 deletions

File tree

  • clustering/src/test/java/com/google/maps/android/clustering/algo

clustering/src/test/java/com/google/maps/android/clustering/algo/BenchmarkTest.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/*
2-
* Copyright 2026 Google LLC
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
171
package com.google.maps.android.clustering.algo
182

193
import com.google.android.gms.maps.model.LatLng
@@ -40,14 +24,29 @@ class BenchmarkTest {
4024
}
4125
}
4226

27+
@Test
28+
fun benchmarkGridBasedAlgorithm() {
29+
runBenchmark(GridBasedAlgorithm(), "GridBasedAlgorithm")
30+
}
31+
4332
@Test
4433
fun benchmarkNonHierarchicalDistanceBasedAlgorithm() {
4534
runBenchmark(NonHierarchicalDistanceBasedAlgorithm(), "NonHierarchicalDistanceBasedAlgorithm")
4635
}
4736

4837
@Test
49-
fun benchmarkGridBasedAlgorithm() {
50-
runBenchmark(GridBasedAlgorithm(), "GridBasedAlgorithm")
38+
fun benchmarkCentroidNonHierarchicalDistanceBasedAlgorithm() {
39+
runBenchmark(CentroidNonHierarchicalDistanceBasedAlgorithm(), "CentroidNonHierarchicalDistanceBasedAlgorithm")
40+
}
41+
42+
@Test
43+
fun benchmarkContinuousZoomEuclideanCentroidAlgorithm() {
44+
runBenchmark(ContinuousZoomEuclideanCentroidAlgorithm(), "ContinuousZoomEuclideanCentroidAlgorithm")
45+
}
46+
47+
@Test
48+
fun benchmarkPreCachingAlgorithmDecorator() {
49+
runBenchmark(PreCachingAlgorithmDecorator(NonHierarchicalDistanceBasedAlgorithm()), "PreCachingAlgorithmDecorator")
5150
}
5251

5352
private fun runBenchmark(algorithm: Algorithm<MyItem>, name: String) {

0 commit comments

Comments
 (0)