Files
core/tests/components
J. Nick Koston 8b067e83f7 Initial orjson support take 3 (#73849)
* Initial orjson support take 2

Still need to work out problem building wheels

--

Redux of #72754 / #32153 Now possible since the following is solved:
ijl/orjson#220 (comment)

This implements orjson where we use our default encoder.  This does not implement orjson where `ExtendedJSONEncoder` is used as these areas tend to be called far less frequently.  If its desired, this could be done in a followup, but it seemed like a case of diminishing returns (except maybe for large diagnostics files, or traces, but those are not expected to be downloaded frequently).

Areas where this makes a perceptible difference:
- Anything that subscribes to entities (Initial subscribe_entities payload)
- Initial download of registries on first connection / restore
- History queries
- Saving states to the database
- Large logbook queries
- Anything that subscribes to events (appdaemon)

Cavets:
orjson supports serializing dataclasses natively (and much faster) which
eliminates the need to implement `as_dict` in many places
when the data is already in a dataclass. This works
well as long as all the data in the dataclass can also
be serialized. I audited all places where we have an `as_dict`
for a dataclass and found only backups needs to be adjusted (support for `Path` needed to be added for backups).  I was a little bit worried about `SensorExtraStoredData` with `Decimal` but it all seems to work out from since it converts it before it gets to the json encoding cc @dgomes

If it turns out to be a problem we can disable this
with option |= [orjson.OPT_PASSTHROUGH_DATACLASS](https://github.com/ijl/orjson#opt_passthrough_dataclass) and it
will fallback to `as_dict`

Its quite impressive for history queries
<img width="1271" alt="Screen_Shot_2022-05-30_at_23_46_30" src="https://user-images.githubusercontent.com/663432/171145699-661ad9db-d91d-4b2d-9c1a-9d7866c03a73.png">

* use for views as well

* handle UnicodeEncodeError

* tweak

* DRY

* DRY

* not needed

* fix tests

* Update tests/components/http/test_view.py

* Update tests/components/http/test_view.py

* black

* templates
2022-06-22 21:59:51 +02:00
..
2021-08-17 17:29:20 +02:00
2022-04-26 09:59:31 +02:00
2022-04-25 07:41:01 -07:00
2022-04-20 08:56:05 +02:00
2022-04-26 16:32:00 +02:00
2022-06-14 20:30:59 -10:00
2022-06-08 00:10:53 +08:00
2022-06-22 09:49:54 +02:00
2022-04-26 23:09:10 -07:00
2022-05-16 21:04:59 -07:00
2022-02-12 11:49:37 -06:00
2022-05-14 06:16:22 -05:00
2022-04-25 10:58:39 +02:00
2022-06-20 12:27:25 +02:00
2022-06-09 20:54:24 -07:00
2022-06-22 10:04:11 +02:00
2022-05-02 15:50:13 +02:00
2022-03-03 15:12:33 -08:00
2022-04-26 16:32:00 +02:00
2022-05-31 15:22:31 +02:00
2022-06-07 06:56:11 -10:00
2022-05-19 13:06:56 +02:00
2022-03-30 12:15:04 +02:00
2021-11-01 20:47:05 -07:00
2022-03-30 16:15:34 +02:00
2022-04-18 16:27:14 +02:00
2022-03-07 18:58:29 +01:00
2022-04-26 16:32:00 +02:00
2021-10-14 10:03:38 -07:00
2022-02-19 20:27:06 +01:00
2022-04-26 16:32:00 +02:00
2022-06-02 13:58:04 +02:00
2021-11-01 20:47:05 -07:00
2022-03-12 12:36:08 +01:00
2021-03-19 15:54:07 +01:00
2021-12-31 09:44:35 -10:00
2022-04-25 21:25:24 -10:00
2022-06-05 15:31:09 -10:00
2022-05-24 09:53:01 +02:00
2022-06-22 20:17:28 +02:00
2022-05-24 16:30:41 +02:00
2022-01-13 15:32:39 +01:00
2022-06-02 17:21:22 +02:00
2022-06-17 11:41:10 -05:00