Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Performance Profiling

This project applies profiling techniques described in Chapter 2 to analyze Python performance in two different scenarios:

🔷 Section 2.1 – I/O-Bound Program

A weather data processing script that:

  • Downloads CSV data from NOAA
  • Stores it locally (disk cache)
  • Reads files
  • Computes minimum temperatures

Profiling showed the program is I/O-bound (network + disk operations dominate runtime).

🔷 Section 2.2 – CPU-Bound Program

A distance computation script using trigonometric operations. Profiling was done with:

  • cProfile
  • SnakeViz
  • line_profiler

Line profiling revealed that most execution time is spent in mathematical operations (sin, cos, atan2, sqrt).


🔹 How to Run

Note for Mac users: Add 3 to all python commands (python3 instead of python)

🔸 Install dependencies

pip install -r requirements.txt

🔸 Section 2.1 (I/O profiling)

python load.py 01044099999,02293099999 2021-2021
python -m cProfile -s cumulative load.py 01044099999,02293099999 2021-2021 > profile.txt
python -m cProfile -s cumulative load_canche.py 01044099999,02293099999 2021-2021 > profile_cache.txt

🔸 Section 2.2 (CPU profiling)

python -m cProfile -o distance_cache.prof distance_cache.py
python -m snakeviz distance_cache.prof

Line profiling:

python -m kernprof -l lprofile_distance_cache.py
python -m line_profiler lprofile_distance_cache.py.lprof

🔹 Evidence

Screenshots and results are included in the report/ folder.

About

Repository for Python performance case studies focusing on I/O bottlenecks and CPU complexity.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages