FastAPI默认使用Python的标准库来做json解析,如果换成rust编写的orjson,速度上会快一些
1. 安装依赖
pip install orjson
2. 设置为默认响应类型
from fastapi.responses import ORJSONResponse
app = FastAPI(title='xxx', default_response_class=ORJSONResponse)
FastAPI默认使用Python的标准库来做json解析,如果换成rust编写的orjson,速度上会快一些
1. 安装依赖
pip install orjson
2. 设置为默认响应类型
from fastapi.responses import ORJSONResponse
app = FastAPI(title='xxx', default_response_class=ORJSONResponse)
2024-06-30 22:06:34
2024-06-30 22:06:14
2024-06-30 22:06:12
2024-06-30 22:06:09
2024-06-30 22:06:08
2024-06-30 22:06:08
2024-06-30 22:06:57
2024-06-30 22:06:55
2024-06-30 22:06:53
2024-06-30 22:06:51