Crystal - Use all core of the processor when running code

Hi, as the title say, I would like when my package manager is calculating the dependencies, it use all of the CPU cores to improve the calculation speed. How can I do that ?

The function responsable of the calculation is this one (it’s just a group of anothers sub functions

module ISM

    module Option

        class SoftwareInstall < ISM::CommandLineOption

            def initialize
                super(  ISM::Default::Option::SoftwareInstall::ShortText,
                        ISM::Default::Option::SoftwareInstall::LongText,
                        ISM::Default::Option::SoftwareInstall::Description,
                        Array(ISM::CommandLineOption).new)
            end

            def start
                if ARGV.size == 2+Ism.debugLevel
                    showHelp
                else
                    userRequest = ARGV[2+Ism.debugLevel..-1].uniq
                    Ism.requestedSoftwares = Ism.getRequestedSoftwares(userRequest)

                    #No match found
                    if userRequest.size != Ism.requestedSoftwares.size
                        wrongArguments = Array(String).new

                        userRequest.each do |request|
                            exist = false

                            Ism.requestedSoftwares.each do |software|
                                if request == software.versionName
                                    exist = true
                                    break
                                end
                            end

                            if !exist
                                wrongArguments.push(request)
                            end
                        end

                        Ism.showNoMatchFoundMessage(wrongArguments)
                        Ism.exitProgram
                    end

                    #No available version found
                    if Ism.requestedSoftwares.any? {|software| software.version == ""}
                        wrongArguments = Array(String).new

                        Ism.requestedSoftwares.each do |software|
                            if software.version == ""
                                wrongArguments.push(software.versionName)
                            end
                        end

                        Ism.showNoVersionAvailableMessage(wrongArguments)
                        Ism.exitProgram
                    end

                    Ism.showCalculationTitleMessage

                    neededSoftwares = Ism.getNeededSoftwares

                    Ism.showCalculationDoneMessage
                    Ism.showSoftwares(neededSoftwares)
                    Ism.showInstallationQuestion(neededSoftwares.size)

                    userAgreement = Ism.getUserAgreement

                    if userAgreement
                        Ism.startInstallationProcess(neededSoftwares)
                    end
                end
            end

        end

    end

end

Is there a smaller example you can provide? That’s a lot of code to read and grok :grimacing:

It’s a bit difficult to provide a short example.

But maybe, is possible to show me a short example of how to use all CPU cores for example to increase the speed when the code browse an array ?

Normally, I need to send different tasks to each cores or is it possible to use all cores for one single task ?