poem-web / poem

A full-featured and easy-to-use web framework with the Rust programming language.
Apache License 2.0
3.5k stars 283 forks source link

Testing Performance #566

Open ghost opened 1 year ago

ghost commented 1 year ago

Hi,

The endpoints in a project using this are slow. Averaging between 1000 and 1400 ms. I'm trying to understand where this time is being taken.

Within the functions themselves I have tested them with:

let start = Local::now();
...
let end = Local::now();
println!("Time taken to execute: {:?}", (end - start).num_milliseconds());

and they average between 100 - 140 ms which I would expect as it includes a sqlx query.

Any ideas as to how I would find where the slowdown is?

It's using poem openapi. So there are a few levels of abstraction that I'm not sure how to test.

ghost commented 1 year ago

After a bit more testing this seems to only be the case when not built in release mode. So not an issue. Would still like to know if there is a way to test this in the future if possible though.