@njit(parallel=True) on Windows 11

I recently got a new laptop, with a better CPU processor (from i5 to i7), NVIDIA graphics card and more RAM. However, my Numba @njit(parallel=True) is running slower.

Is it likely that this could be due to the new laptop having Windows 11 installed?

When I bring up Numba system information, it says that it is installed on a Windows 10 machine:

__OS Information__
Platform Name                                 : Windows-10-10.0.22621-SP0
Platform Release                              : 10
OS Name                                       : Windows
OS Version                                    : 10.0.22621
OS Specific Version                           : 10 10.0.22621 SP0 Multiprocessor Free
Libc Version                                  : ?

Example code:

from datetime import datetime
from numba import cuda, njit
import numpy as np

@njit(parallel=True)
def rms(y):
“”" calculates the root mean square of an array
“”"
rms = np.sqrt(np.mean(y**2))
return rms

x = np.random.rand(100000000)

start = datetime.now()
result = rms(x)
print(‘with @njit:’, datetime.now()-start)

def rms(y):
“”" calculates the root mean square of an array
“”"
rms = np.sqrt(np.mean(y**2))
return rms

start = datetime.now()
result = rms(x)
print(‘without @njit:’, datetime.now()-start)

with @njit: 0:00:01.297192
without @njit: 0:00:00.215754

you’re including the compile time in your runtime… try calling the jitted function once prior to starting the timing.

Hi, I’m not sure what you mean as I’m only timing the line that runs the function

See A ~5 minute guide to Numba — Numba 0.58.0dev0+116.gbd5b553b0.dirty documentation

Thanks for this. This does show numba working faster, but on a much larger script I have, with multiple functions, it runs faster when I have @njit(parallel=True) commented out… which I didn’t have on a previous laptop.