Pro Yearly is on sale from $80 to $50! »

20190409_FasterPythonMeetUp_TAMIYA

9b68af6c519bd08da4eb0fa367c73ace?s=47 tatamiya
April 08, 2019

 20190409_FasterPythonMeetUp_TAMIYA

9b68af6c519bd08da4eb0fa367c73ace?s=128

tatamiya

April 08, 2019
Tweet

Transcript

  1. Cython        numpy @tatatatatamiya

  2. >C2 & "/#9BA 3+.87=%<-@(B  ,$1Python, C$1 !) 65 D:*4';

    0?, Vim
  3.   u A<-26 ', )(/;0  u Scikit-learn= 7

    u @3&%!#4. +"*$(4 u For8?: 5 u → 91> 
  4. %-&  u CythonC(,* .  u CFortran !') u

    Numba0jit(just in time) $"#+ →   2 u /1&
  5. /, *  u 1 ~ N %') ($ def

    sum_from_one(k): sum = 0 for i in range(1, k+1): sum += i return sum sum_list = [] for i in range(0, N): sum_list.append(sum_from_one(i))  (N=10000) -Python 2.09 s  28.3 ms Cython 6.36 ms  62.5 µs +.#(joblib) 702 ms  21 ms MacBook Pro 13!(2018" ) &4 16GB OSmacOS Mojave 10.14.1
  6. 2"%  3  u -8<47 1#'+, u *' 0

    u 9:/ &$-5! 47 u Numpy linalg.lstsq ).% u -5@6(&$ 0'?  (N=10000) = Python 1.77 s  74.1 ms Cython 1.74 s  24.2 ms ;>#(joblib) 800 ms  20.7 ms
  7. C>Cython u  u + )2;B8-<F:0 u NumpyD41.JHCython? I MN

    u L u + )1.OpenMPKO3 u # ',G? I A67 / … *%&C9E !($ "&5= @ 
  8. (joblib) u     (N) Python (joblib) 

     103 83.9 ms  2.1 ms 107 ms  5.96 ms 0.78 104 2.09 s  28.3 ms 702 ms  21 ms 3.0 105 1min 50s  3.61 45.5 s  1.07 s 2.4
  9. ,/ u -#(Numpy 0+ . ' 25 u &4* 

      u Cython : 0+ ! %$ u 68*710+9) 3)" %$
  10.   OSS '5, u Scikit-learn&$ u 1")./*%Numpy, Scipy6# 

    u !  Cython  2 u 743+(0 OSS-