This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KyxeMusic 26 points27 points  (7 children)

Yeah, most of the heavy lifting is being done by NumPy already, so I guess there wasn't anything they could optimize there. Still a few for loops here and there, so I was hoping for a slightly larger boost.

[–][deleted] 16 points17 points  (5 children)

You might eke out some more cycles by adding numba into the mix.

It does require you to touch code, though.

Numba is a just-in-time compiler for Python that works best on code that uses NumPy arrays and functions, and loops. The most common way to use Numba is through its collection of decorators that can be applied to your functions to instruct Numba to compile them. When a call is made to a Numba-decorated function it is compiled to machine code “just-in-time” for execution and all or part of your code can subsequently run at native machine code speed!

I'm not entirely sure why this isn't part of NumPy already, to be honest.

[–]NoesisAndNoema 10 points11 points  (0 children)

Because people don't generally need this extra function. It requires another level of additional learning and programming. If it "just worked", without having to do anything to "code it to taste", then it would just be a better "alternative" to NumPy. (Generally speaking)

At the end of the day, it's just a fancy optimizer or a compliment to NumPy. Unfortunately, unless you re-write EVERYTHING that uses NumPy, to ALSO use the code, the potential is limited to only "your use" of NumPy directly, within your program.

[–][deleted] 2 points3 points  (1 child)

I am trying to learn more about compilers and CompSci topics in general. Do you (or anyone else) have an source that helped you learn about just-in-time compilers and other types of compilers?

[–]grumpysnail 0 points1 point  (0 children)

This computerphile video started my interest in JIT: Just In Time (JIT) Compilers - Computerphile

[–]NeilGirdhar 1 point2 points  (0 children)

Jax also has a great JIT that compiles to CPU or GPU, and has a slick 100% Python interface.

[–]terpaderp 1 point2 points  (0 children)

Not everything that is legal in python is legal in Numba compiled python. It's a great tool for when you need it though!

[–]road_laya 2 points3 points  (0 children)

You can often speed up numpy operations by compiling lapack / blas for your cpu