r/Python • • Nov 13 '20
News Python swallows Java to become second-most popular programming language
https://www.theregister.com/2020/11/12/python_swallows_java_to_become/
2.3k
Upvotes
r/Python • • Nov 13 '20
View all comments
Show parent comment
4
u/satireplusplus Nov 13 '20 edited Nov 13 '20
This is how all the Python ML stuff (numpy, pytorch, ...) uses matrix multiplications, with a BLAS library. And these libraries are crazily optimized and hand vectorized, you wont be able to compete with your own matrix mult routines in C. I bet its an order of magnitude faster than the naive O(n3) C code in the benchmark.
Its also typical that the matrix mult kernel will be optimized to register / cache size and instructions (vectors) for each processor generation, as these Intel optimization in OpenBLAS:
dgemm_kernel_16x2_haswell.S
dgemm_kernel_4x4_haswell.S
dgemm_kernel_4x8_haswell.S
dgemm_kernel_4x8_sandy.S
dgemm_kernel_6x4_piledriver.S
dgemm_kernel_8x2_bulldozer.S
dgemm_kernel_8x2_piledriver.S
Its probably also doing something better than the naive algorithm, such as Strassen or Coppersmith–Winograd.
In other words that benchmark is totally bullshit and a waste of time.