# Improve loading times for extension themes \(\#40015\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/81cd435e08d395bf6df91b7c3d8fc5751e46ea93)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 81cd435e08d395bf6df91b7c3d8fc5751e46ea93

Requested commit: 81cd435e08d395bf6df91b7c3d8fc5751e46ea93

Commit: 81cd435e08d395bf6df91b7c3d8fc5751e46ea93

Tree: fd3bd42d1480447b0367185aa0a4e862252d692a

Author: Finn Evers

Committer: GitHub

## Message

```
Improve loading times for extension themes (#40015)

This PR primarily does two things:
- replace `serde_json::from_reader` with `serde_json::from_slice`, as
the latter is much much faster, even with loading the file into memory
first.
- runs the initial loading of themes and icon themes coming from
extensions in parallel instead of sequential.

Measuring the `eager_load_active_theme_and_icon_theme` method, this
drastically improves the speed at which this happens (tested this method
primarily with debug builds on my MacBook Pro, but the `Before`
measurement was also confirmed against a `release-fast` build):
- Before: ~260ms on average (in one run, it even took 600ms)
- After: ~20ms on average

Which reduces the time this method takes to load these by around ~92%.

Given that we block on this during the initial app startup, this should
drastically improve Zeds initial startup loading time. Yet, it also
improves responsiveness when installing theme extensions and trying
these.

I also replaced all other `serde_json::from_reader` implementations with
`serde_json::from_slice` and added the former to `disallowed_methods`,
given
https://github.com/serde-rs/json/issues/160#issuecomment-253446892.

Release Notes:

- Improved Zed startup speed when using themes provided by extensions
```

## Parents

- [47a66c938f9fe380c5c8c3eb5d80ea9990d8dcde](https://git.cafe/gitcafe/zed/commit/47a66c938f9fe380c5c8c3eb5d80ea9990d8dcde?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/81cd435e08d395bf6df91b7c3d8fc5751e46ea93?format=markdown)
