Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build speed #78

Open
Mark-H opened this issue Apr 2, 2015 · 2 comments
Open

Improve build speed #78

Mark-H opened this issue Apr 2, 2015 · 2 comments
Assignees

Comments

@Mark-H
Copy link
Member

Mark-H commented Apr 2, 2015

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.

@Mark-H Mark-H self-assigned this Apr 2, 2015
@Mark-H
Copy link
Member Author

Mark-H commented Apr 2, 2015

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.

@Mark-H
Copy link
Member Author

Mark-H commented Apr 5, 2015

Implemented the change from the previous comment in commit a4204d5

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant