holoviz / holoviz/param

Speed up load with 2% by improving _register_watcher

Open
#888 3 comments 0 reactions 0 assignees View on GitHub
performance
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

I'm on the `main` branch of Panel trying to find performance improvements. I can see that `_register_watcher` shows up spending ~8% of the time in the profiling report.

![image](https://github.com/holoviz/panel/assets/42288570/ed4903d5-3ef9-4308-9637-216f44e83791)

My guess is that this can be improved 25% by looking up things more efficiently and testing `in` on sets or dictionaries instead of lists.

## Reproduce

```python
import panel as pn

N=10

pn.Column(
*[pn.Row(
*[pn.pane.Markdown("Hello World") for i in range(N)]
) for i in range(N)]
).servable()
```

Run

```bash
panel serve script.py --index script --admin --profiler pyinstrument
```

Open the app 5 times and inspect the performance report.

![image](https://github.com/holoviz/panel/assets/42288570/845f1ec8-5c2e-4608-a968-ea942f90fbb6)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.