Skip to content

Commit 8a21317

Browse files
committed
Fix performance tests
1 parent 1df173e commit 8a21317

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Map/tests/Cluster/ClusteringPerformanceTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public function testScenarioRegion50000(ClusteringAlgorithmInterface $algorithm,
6565
*
6666
* @dataProvider algorithmProvider
6767
*/
68-
public function testScenarioCountry50000(ClusteringAlgorithmInterface $algorithm, float $zoom): void
68+
public function testScenarioCountry5000(ClusteringAlgorithmInterface $algorithm, float $zoom): void
6969
{
70-
$points = $this->generatePoints(500000, 30, 60, -10, 35);
70+
$points = $this->generatePoints(5000, 30, 60, -10, 35);
7171

7272
$this->runPerformanceTest($algorithm, $points, $zoom);
7373
}
@@ -94,15 +94,14 @@ private function runPerformanceTest(ClusteringAlgorithmInterface $algorithm, arr
9494
$elapsed = microtime(true) - $startTime;
9595

9696
$this->assertLessThan(2.0, $elapsed, $algorithm::class." took too long: {$elapsed} seconds (zoom {$zoom}, ".\count($points).' points)');
97-
// echo $algorithm::class." ($zoom): ".($elapsed * 1000)." ms\n";
9897
}
9998

10099
private function generatePoints(int $count, float $latMin, float $latMax, float $lngMin, float $lngMax): array
101100
{
102101
$points = [];
103102
for ($i = 0; $i < $count; ++$i) {
104-
$lat = mt_rand((int) ($latMin * 100), (int) ($latMax * 100)) / 100.0;
105-
$lng = mt_rand((int) ($lngMin * 100), (int) ($lngMax * 100)) / 100.0;
103+
$lat = random_int((int) ($latMin * 100), (int) ($latMax * 100)) / 100.0;
104+
$lng = random_int((int) ($lngMin * 100), (int) ($lngMax * 100)) / 100.0;
106105
$points[] = new Point($lat, $lng);
107106
}
108107

0 commit comments

Comments
 (0)