4 ms·
A good start would be to not do silly things like body = request.json key = json.dumps(body) in the prediction code to begin with: https://github.com/
by akx 4y ago
A good start would be to not do silly things like
body = request.json
key = json.dumps(body)
in the prediction code to begin with: https://github.com/postgresml/postgresml/blob/15c8488ade86b0b68be52aa8af40a1152d292c06/pgml-docs/docs/blog/benchmarks/python_microservices_vs_postgresml/predict.py#L17-L18 https://github.com/postgresml/postgresml/blob/15c8488ade86b0...
- polskibus 4y agoasking as a person that does not use Python every day - what would be a better solution here?
- manfre 4y agorequest.json is converting the request payload from a str to a dict. json.dumps converts it back to a str.
- levkk 4y agoIf I turn that into a single line and that improves performance 40x... I will probably not do engineering for a while after that.
- learndeeply 4y agoThe parent comment said it would be "a good start". It's like adding sleep(1000) to a benchmark to purposely make it look worse than your own product.