3 Easy Ways to Improve The Performance Of Your Python Code

Written by bkotis | Published 2020/07/11
Tech Story Tags: python | data-science | benchmark | performance | python-programming | python-tutorials | big-data | code-performance

TLDR You can benchmark your Python code line by line using line_profiler. This benchmarking library has significant overhead, but it's perfect for finding weak points in your code and replacing them with something more efficient. Avoid loops when possible. Compile your Python modules using Cython or Cython. Cython is not a general purpose python to C compiler, Cython lets you compile your python modules into shared object files(so), which can be loaded by your main python script. For example, the map version is over 6X faster than the original.via the TL;DR App

no story

Published by HackerNoon on 2020/07/11