Sebastian Witowski - Writing Faster Python 3

Поділитися
Вставка

КОМЕНТАРІ • 3

  • @jimratliff
    @jimratliff 11 місяців тому

    The best talk I have ever seen on actionable ways to optimize Python source code. Particularly: showing the trade-offs and that the answer is sometimes “it depends.“

  • @nescius2
    @nescius2 9 місяців тому

    40:00 ...don't sacrifice readability for -small performance gains- list comprehensions

  • @PaulJurczak
    @PaulJurczak 9 місяців тому +1

    @10:47 You are timing both the compilation and execution of Numba example. It is unfair. Numba is able to replace the loop with a formula you show later (Python 3.11, Numba 0.56.4). The execution is extremely fast. On my PC [ms]: Python loop 51.6, NumPy 3.7 and Numba 0.00022! A more "fair" example, i.e. forcing each version to run the loop, would be `total += x%9`. Timing of one million iterations [ms]: Python loop 42.6, NumPy 7.3 and Numba 0.77! Numba is still an order of magnitude faster.