Skip to content

Commit 3d16d79

Browse files
author
Brady Law
committed
Perf improvements for 10k+ points
1 parent 6855624 commit 3d16d79

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ foreach ($result as $item) {
139139
```
140140

141141

142+
Testing
143+
-------
144+
```
145+
cd tests/
146+
GEOPHP_RUN_TESTS=1 php tests/test.php
147+
```
148+
142149
Credit
143150
-------------------------------------------------
144151

lib/geometry/Collection.class.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ public function numPoints() {
231231
public function getPoints() {
232232
$points = array();
233233
foreach ($this->components as $component) {
234-
$points = array_merge($points, $component->getPoints());
234+
foreach ($component->getPoints() as $point) {
235+
$points[] = $point;
236+
}
235237
}
236238
return $points;
237239
}
@@ -290,7 +292,9 @@ public function isSimple() {
290292
public function explode() {
291293
$parts = array();
292294
foreach ($this->components as $component) {
293-
$parts = array_merge($parts, $component->explode());
295+
foreach ($component->explode() as $subComponent) {
296+
$parts[] = $subComponent;
297+
}
294298
}
295299
return $parts;
296300
}

0 commit comments

Comments
 (0)