crystal-community / crystal-libraries-needed

A list of libraries that are needed or wanted for the Crystal-Language
141 stars 4 forks source link

Application profiler #94

Open straight-shoota opened 6 years ago

straight-shoota commented 6 years ago

I was thinking about a reusable API for profiling code to see which parts of an application take the most resources. Metrics should be at least execution time, maybe even memory consumption or other data. But that would be an enhanced step.

Now, there are obviously tools like gprof which can be used to just analyse the execution of the binary. I'm talking about a different approach, where the profiling instrumentation would be directly embedded into the application as this can give better insight into individual components and is easily usable.

The API could look something like this:

Profiler.profile("Expensive calculations") do
  calculate_gulf_stream_flow
end

And this should then aggregate performance metrics when executed.

You probably wouldn't want the profiler to run always, so there could be two ways of (de-)activating it: