Please help to find out where're slow parts

Hi everyone.

I implemented a dialog system in Rust
it took approx 60ms(release mode) 280ms(debug mode) for each request

it's slower than my expect

The crates I used were:

  1. Axum(0.16)
  2. Redb(1.0.5)
  3. serde and serde_json (latest)
  4. rkyv (latest)

Running machine was

  1. Windows 10 Home Edition
  2. Intel i3-380M (2010)
  3. SSD hard drive
  4. 8G Memory

I captured a flamegraph

Raw SVG was here:

But I don't know which part made it slow

Thanks in advance

We aren't going to be able to help you much without seeing some code.

That said, looking at the flame graph it seems a fair amount of time is being spent on Vec operations, and I assume the libc stuff is allocation, so a place to start would be to ensure vectors are preallocated (using Vec::with_capacity()) and check for unnecessary clone()s.

I might found the issue, it's database connection.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.