if __name__ == '__main__':
    a = zip(np.random.rand(5000, 2), np.random.rand(5000, 2))
a = [Path(x) for x in a]
b = zip(np.random.rand(300, 2), np.random.rand(300, 2))
now = time.time()
if len(sys.argv) >= 2:
    res = Parallel(n_jobs=int(sys.argv[1]))(delayed(check_paths)(Path(
        points)) for points in b)
else:
    res = [check_paths(Path(points)) for points in b]
print('Finished in', time.time() - now, 'sec')
Joblib Parallel multiple cpu's slower than single