WinPlay02 / GitCraft

Generate a repo of decompiled MC. Do not share the generated repo.
35 stars 8 forks source link

Multithreading #5

Open viciscat opened 2 months ago

viciscat commented 2 months ago

bit of a big ask... but multi threading maybe? Because if i understand correctly it decompiles everything and generates commits from the diffs? Why not do all the decompilation on multiple threads.

(i don't know shit about gradle tasks)

WinPlay02 commented 2 months ago

Yes, everything is decompiled and then added to the repository. But the decompilation step should already use multiple threads, depending on the executing hardware. See here for the decompiler preference: https://github.com/WinPlay02/GitCraft/blob/e599507f87b939115aa0e8479e61aed7a3e6411e/src/main/groovy/com/github/winplay02/gitcraft/pipeline/DecompileStep.java#L89

and here for specifying the amount of threads: https://github.com/WinPlay02/GitCraft/blob/e599507f87b939115aa0e8479e61aed7a3e6411e/src/main/groovy/com/github/winplay02/gitcraft/GitCraftConfig.java#L35

Maybe increasing the number of threads in the config (to all available cores instead of amount of cores - 3) already helps with speeding up decompilation. The remapping step also uses multiple threads, but that already doesn't take very long.

viciscat commented 2 months ago

There probably is multi-threading and I just never noticed, unless i'm stupid, it doesn't flash in big red letters "WOW you are using multithreading! so cool". But if you say there's multithreading then I believe you. I more thought multithreading would be this core does this snapshot and that other core does that snapshot etc.

WinPlay02 commented 2 months ago

this core does this snapshot and that other core does that snapshot etc.

For the decompilation step specifically, I don't think that it would lead to a (huge) speedup. But this form of multithreading would be beneficial for other tasks (like fetching assets, libraries, ...). Considering that, a bit of refactoring needs to happen to make this possible, which I cannot do right now, because my time is pretty limited. I plan to implement this optimization in the future, though.