marcusvolz / strava_py

Create artistic visualisations with your exercise data (Python version)
MIT License
163 stars 19 forks source link

Use multiprocessing to speed up processing of input files #9

Closed hugovk closed 2 years ago

hugovk commented 2 years ago

Use multiprocessing to speed up processing of input files, using the number of processes which matches the CPU count.

On my old dual-core Mac, the processing step speeds up:

Will be a larger gain for machines with more CPUs.

multiprocessing needs a single worker function, this is the new process_file which decides which of process_gpx and process_fit to call. They also need to be top-level functions to work with multiprocessing.

I also formatted the file using the popular Black autoformatter:

python -m pip install -U black
black . 

I also fixed a bug when using an input path like ~/dir, it needs to expand ~ before checking it's a dir (and appending *).

marcusvolz commented 2 years ago

Very cool.