Improve build speed
The build can take a pretty long time on big sites with lots of objects. There may be room for improvement by refactoring the way the build runs.
The primary idea (that needs more R&D) is to grab all existing rows in the database in one request and storing that in an array/ArrayIterator or something, and using that instead of doing a getObject for each individual row. The flip side is that it would take more memory - especially on large datasets - but maybe that is be offset by the fewer database queries, or by keeping data in memory as arrays instead of xPDOObject.
Adding the ability to specify the type to build per #51 will also help greatly, but for production deploys you are likely to always use the full build (and maybe even a force build), so speeding up the build in general would make gitify a lot better and pleasant to use.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Another improvement that comes to mind looking at the current source is to skip the getObject at https://github.com/modmore/Gitify/blob/master/src/Command/BuildCommand.php#L366 when using --force because it will not return anything anyway.
Implemented the change from the previous comment in commit a4204d59c477389af7bcdec197666c258f6fb288
Test case is a project with just over 1000 resources in a single context, running on my mid 2012 entry level macbook air.
Before:
Marks-MacBook-Air:project mhamstra$ Gitify build content --force
Writing database backup to ...
Building content from content/...
Forcing build, removing prior Resources...
- Building web context...
Clearing cache...
Done! Time: 89,335ms | Memory Usage: 12,51 mb | Peak Memory Usage: 17,01 mb
After:
Marks-MacBook-Air:project mhamstra$ Gitify build content --force
Writing database backup to ...
Building content from content/...
Forcing build, removing prior Resources...
- Building web context...
Clearing cache...
Done! Time: 78,761ms | Memory Usage: 12,51 mb | Peak Memory Usage: 17,01 mb
Not a very scientific test as I didn't try a lot of runs before and after, but the time went about 10% into the right direction :D