| .. | ||
| bench | ||
| data | ||
| conventions.md | ||
| README.md | ||
| setup.md | ||
| status.md | ||
plotly.py Optimization
Performance optimization case study for plotly/plotly.py.
Results
| Optimization | Target | Before | After | Improvement | Status |
|---|---|---|---|---|---|
| Iterative split_multichar | _plotly_utils/utils.py:394 |
1.76µs | 0.86µs | 2.05x | Committed locally |
Optimization Targets
6 pre-identified targets focused on deepcopy overhead, quadratic validation, and string parsing:
- to_dict() deepcopy —
basedatatypes.py:3321(needs mutation analysis) - _set_compound_prop() double deepcopy —
basedatatypes.py:5361-5366(needs mutation analysis) - add_traces() deepcopy —
basedatatypes.py:2272(needs mutation analysis) - ColorValidator quadratic validation —
basevalidators.py:1370-1388(needs code reading) - _vals_equal() numpy comparison —
basedatatypes.py:5722(skip — marginal gain) - split_multichar() —
_plotly_utils/utils.py:394(done — 2.05x)
Approach
- Profile hot paths in figure creation, serialization, and validation
- Benchmark with realistic workloads (large datasets, many traces)
- Submit individual PRs with hyperfine/codeflash benchmark numbers
Repo Structure
.
├── README.md # This file
├── status.md # Session state for resuming work
├── setup.md # Environment setup notes
├── conventions.md # Optimization target details
├── bench/ # Benchmark scripts
│ ├── bench_split_multichar.py
│ └── bench_vals_equal.py
└── data/
└── results.tsv # Raw benchmark results