Open pavel-trafimuk opened 3 months ago
Hello @pavel-trafimuk ,
thank you for creating this issue. Just as a note, did you check out my article on parallelization of Sourcery when generating mocks here?
It might just be what you need, but of course, there are always ways to optimize Sourcery more and more.
Article is about using swifttemplate
templates.
Ok, will jump in it and later come back with more stupid ideas )) Anyway most of the templates are Stencil, we have only one swifttemplate and always want to replace it on stencil (we even moved from SwiftyMocky to stencil automockable - swifttemplates were too long for our codebase)
Currently we have 150+ modules with 300+ targets in project, each module has same assembly+injection code which is auto-generated by Sourcery. To make generation faster, we're preparing list of ymls (1 per module) and launch sourcer(y)-ies in parallel for each module=yml. Codebase (source files and output files) doesn't intersect, so it works well.
Im looking how we can improve performance of this approach. One of found 'issues' - each sourcery is separated instance, so some unified values each time are loading, e.g. templates. Much better to have one Sourcery instance, also it already supports having one yml with multiple configations. So I can combine all 150 ymls in one and launch Sourcery one time BUT as I see in the code, in such case Sourcery launches these sub-configurations in serial, not parallel. Does it some special limitation or maybe It's just not implemented yet. To understand better, pls look around
let keepAlive = try configurations.flatMap