Performance analysis
Ali Darudi wrote:
I tried out some fancy stuff I didn’t even know existed until basically yesterday — runtime profiling in Python. It lets you track exactly where the code spends its time during execution, and visualize it nicely (see screenshot below).
Here’s what stood out (for a run of 2050 only, resolution of 8 days):
- As expected, a big chunk of time goes into the Gurobi solver (\~57 min).
- But a surprisingly large chunk (\~30 min) is used just for exporting results to Excel — we’re writing \~175 million cells, one by one.
- Most of the export time is in formatting and per-cell write operations.
What this means going forward:
- We’ll get a major speedup if we write large datasets to CSV or HDF5 instead of Excel.
- If Excel is still needed, we should switch from writing individual cells to writing whole rows or blocks.
- We should also reduce how much we export, and limit formatting wherever possible.
Let’s take this as input for refining our output pipeline over time. Best, Ali
Below: 1) screenshot of tasks, ordered by tottime, 2) ChatGPT analysis of Excel part ...
1. Screenshot of tasks

2. ChatGPT analysis of Excel part
Excel Export: Core Bottlenecks These are all related to writing large amounts of data into an Excel file.
-
worksheet.py:627(_write_number)
-
excel.py:79(init)
-
excel.py:870(_generate_body)
-
excel.py:591(_format_value)
-
worksheet.py:6808(_write_cell)
-
worksheet.py:481(_write)
-
excel.py:886(get_formatted_cells)