riker-rs / riker

Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
https://riker.rs
MIT License
1.01k stars 71 forks source link

Profiling/Tracing library for riker #134

Open hardliner66 opened 3 years ago

hardliner66 commented 3 years ago

After doing some basic performance testing with hyperfine, I wanted to get a deeper understanding of the performance characteristics of riker.

So I integrated two tracing/profiling libraries. optick-rs and tracing.

I prepared three branches, but wanted to get community feedback before I create a pull request.

Optick

Riker + Optick

Optick is a profiler written for games, which just got it's rust bindings a few months ago. After annotating all functions with the proc-macro for optick (you can create spans manually if you like), you only need to specify where the logs should go and optick creates a file with all the profiling data inside, which can than be inspected with the Optick profiler gui.

Pros:

Cons:

Tracing

Riker + Tracing

Tracing on the other hand, is an instrumentation framework for which it's possible to write a custom Subscriber, in order to use whatever profiler you want.

Pros:

Cons:

Both

Riker + Tracing + Optick

Adds both to riker, with optick as the default.

Pros:

Cons:

Final thoughts

I currently am in favor of the last variant, wich includes the tracing library and a specific profiling library. This way all contributors would have a standard profiler to use, but everyone can plug their own profilere if the profiler we chose doesn't fit their needs.

I picked Optick as the default profiler because it was easy to integrate, provides a nice gui und is built for use in games (or similar applications where performance matters), but I'm open for other profilers to use as a default.

olexiyb commented 3 years ago

@hardliner66 Have you tried to use native tools like callgrind that is a tool of valgrind There is a GUI This tool does not need to change the code, just need some compiler options to add debug information.

hardliner66 commented 3 years ago

@olexiyb Valgrind is linux only. And an integrated profiling/tracing library can provide addtional information on top of a call-graph.

leenozara commented 3 years ago

@hardliner66 I'll take a look at your suggestions and provide feedback - I've been unavailable for the past couple of weeks - hopefully this week.

Thanks!

nothingismagick commented 3 years ago

I like the idea of the third version (profiling && tracing), but since this issue was opened it still seems (superficially at least) that optick does not yet support OSX and linux:

image

Edit: checked the rs repo and still no public availability on MacOS / Linux :(