• Womble@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    4 months ago

    Nope, if you’re working on large arrays of data you can get significant speed ups using well optimised BLAS functions that are vectorised (numpy) which beats out simply written c++ operating on each array element in turn. There’s also Numba which uses LLVM to jit compile a subset of python to get compiled performance, though I didnt go to that in this case.

    You could link the BLAS libraries to c++ but its significantly more work than just importing numpy from python.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      4 months ago

      numpy

      Numpy is written in C.

      Numba

      Numba is interesting… But a) it can already do multithreading so this change makes little difference, and b) it’s still not going to be as fast as C++ (obviously we don’t count the GPU backend).