Improve getPoints() + explode() performance for large geometries
Issue
For geometries with 10k+ points, it can take 10+ seconds on a modern machine to call getPoints() or pointInPolygon().
Root Cause
The points array was built using array_merge(), which gets more complex (n^2) as the array gets larger.
Fix
Use simple array appending instead of array_merge()
Before:
$ time ../vendor/bin/phpunit tests/largeInputTest.php
real 0m13.354s
user 0m13.318s
sys 0m0.030s
After:
$ time ../vendor/bin/phpunit tests/largeInputTest.php
real 0m0.194s
user 0m0.172s
sys 0m0.016s
Nice improvements, but I also fixed it in pull requests #103 and #125.
@BathoryPeter Thanks for the info. #103 is closed and #125 looks like a pretty large change.
Perhaps this a smaller one that can be added sooner.
This repo looks kind of abandoned/un-mantanied. FYI, this has been embedded/fixed into this fork repo: https://github.com/itamair/geoPHP throughout this commit: https://github.com/itamair/geoPHP/commit/c1a7af62e126f680f4c5ef898602e435826292f3