Skip to content

rafaelhenrique/go-improves-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

Go improves Python?

This project is based on this project created by @rochacbruno. But this project uses Golang rather than Rustlang.

This project has only one objective, which use Golang with Python as a possibility to have more performance on certain tasks.

Comparisons between Python and Go

find_cnpj

Locate CNPJ number based on company name.

  • CNPJ data downloaded from this link.

sum_numbers

Sum sequences (list, tuple, generator.. etc) of numbers.

Run

Create your virtualenv directory:

  • IMPORTANT RECOMENDATION: use your Python3.6 (native, without pyenv or similar) from O.S.
/usr/bin/python3.6 -m venv .venv

Activate your venv:

source .venv/bin/activate

Install requirements:

pip install -r requirements.txt

Enter on directory of project (find_cnpj or sum_numbers), and run benchmarks:

cd <directory of project>

# Recreate binary files
make build

# For unit tests
make test  

# For benchmark tests (time/operations)
make benchmark

# For memory profile
make profile-memory

Tips and tricks

Finding python version on pkg-config

$ pkg-config --list-all | grep python
python-3.6m               Python - Python library
python-2.7                Python - Python library
python                    Python - Python library
python-3.6                Python - Python library
python2                   Python - Python library
python3                   Python - Python library
notify-python             notify-python - Python bindings for libnotify