Comparation between "for" and "join" in python, testing which version is more efficient.
- python >= 3.6
- memory-profiler == 0.57.0
In this section installation using virtualenv for linux will be explained. You must install virtualenv if you have not, you can follow the installation guide.
Once you have virtualenv installed, open the terminal in project's directory and write the following command in terminal
virtualenv .venv -p $(which python3)
To activate the virtualenv:
source .venv/bin/activate
Once we have our virtualenv activated, we can install the requirements.
pip install -r requirements.txt
Now you can run the test with:
python3 code/tests.py
In this tests, memory and executing time have being measured in order to obtain which of the two versions, 'for' or 'join', is more efficient.
Tested arrays will have a changing number of strings, depending on the case.
- OS: Zorin OS 15.3
- Memory: 15.6 GiB
- Processor: Intel Core i5-6500 CPU @ 3.20GHz x 4
- OS Type: 64-bit