damogranlabs / VS-Code-STM32-IDE

Use VS Code as STM32 IDE with CubeMX
MIT License
247 stars 52 forks source link

#FeatureRequest Parallel building #5

Closed Nostras closed 5 years ago

Nostras commented 5 years ago

Hi Domen,

I've tried your tool and it works pretty good so far. Could I ask you to implement some sort of -j command in the makefiles somewhere? I simply added the -j12 arg to the make command and that worked for me. This command cuts my build times for egregiously cases from over a minute to less than 10 seconds.

schperplata commented 5 years ago

Hello and thank you ;) Adding new common switches to Makefile or 'make' command is generally not a good idea - someone might have a different configuration/CPU, different hardware or simply don't want this switch. In case of -jX command, X is number-of-cores-specific switch, meaning: I might have only 2 cores, while you have 4. I don't know what exactly will happen if this switch is not properly configured. So, no, this will not be added. Anyway, there are other simple solutions for your request:

Nostras commented 5 years ago

Well, yeah, the -j12 is useful for my work pc and home pc, but I can't imagine you can't just add some detection. Heck I whipped up python and executed two commands. image

Adding more threads than there are available simply does nothing. Or, well, it might every so slightly degrade it. The only true problem I could see by adding this function is that for some reason some code may not be compiled in parallel, but I've never had that problem with embedded code for the ST at least.

schperplata commented 5 years ago

After a short break, I decided to give it a try and I have implemnted this feature. Added '-jX' switch, where X is NUMBER OF CORES *1.5. 1.5 number is advised on many GNU make forum posts, so I go with this number. On my 4-core PC there is not that much difference in time (about 20%), but I agree that every second you have must wait is a wasted second.

Update your ideScripts.