what about multithreading ?
First set threads you want to use by setting an environment variable
using Images import Dates # using BenchmarkTools RBC_dir = "/home/Bok/Downloads/RBC_Data/"; samples = readdir(RBC_dir); function BrennerScore(image_path) gray_img = floor.(Int, channelview(Gray.(load(image_path)))*255); return sum((gray_img[:, 1:end-2] - gray_img[:, 3:end]).^2) end for sample_dir in samples images_files = readdir(joinpath(RBC_dir, sample_dir)); Threads.@threads for image_file in images_files println(sample_dir, " ", image_file); println(BrennerScore(joinpath(RBC_dir, sample_dir, image_file))); end end
Look at Threads.@threads in inner for loop, it will immediately turn that inner for loop to run in parallel way