/
Rebuild classmap in parallel [5.3.0-B1]
Rebuild classmap in parallel [5.3.0-B1]
One of the features in In-Portal 5.3.0 release is automatic filename detection, where each class/interface/trait is declared. This helps in following ways:
- there is no need to specify "path" option any time new class is added (just run "in-portal classmap:rebuild" command in CLI)
- for helper classes no need to specify anything (just run "in-portal classmap:rebuild" command in CLI)
The only downside is that when executed for the 1st time the "in-portal classmap:rebuild" command takes considerable amount of time (~1 minute) to run.
Proposing to use https://packagist.org/packages/console-helpers/process-iterator component I've made to run code in parallel processes.
Solution
- connect https://packagist.org/packages/console-helpers/process-iterator package
- create the "in-portal classmap:rebuild_file" command, that would take one file as input and echo back JSON with results
- after files, that needs to be checked are found use "ProcessIterator" class (from above added package) to:
- run 8 processes in parallel
- each process fould use "in-portal classmap:rebuild_file /path/to/file.php" command to process that file (or get data from cache)
- join result of sub-process with main result array
- store all back to disk