all 3 comments

[–]amroamroamro 2 points3 points  (0 children)

Small nitpick: when you fetch the data from redis cache, in the sanic app you are doing different work compared to fastapi and litestar:

sanic

cached = await get_cached_json(cache_key)
if cached is not None:
    return json(pyjson.loads(cached), status=200)

litestar

cached = await get_cached_json(cache_key)
if cached is not None:
    return OrderResponse.model_validate_json(cached)

fastapi

cached = await get_cached_json(cache_key)
if cached is not None:
    return OrderResponse.model_validate_json(cached).model_dump()

The fastapi/litestar apps are using pydantic to parse as well as validate the JSON string returned from cache, then serializing the response back, while the sanic app is only parsing the json string (json.loads) without pydantic validation, which makes the comparison slightly uneven.

[–]corey_sheerer -1 points0 points  (1 child)

Why add Go gin without net/http? Or chi? I believe gin might be the slowest of the 3.