Profiling scala code in 2018

I’d like to profile some code I’ve written, to find out how much time is being spent in which functions.

Simple logging isn’t enough to help me as a lot of processing is being done in parallel, which makes it hard to track this manually.

I’ve done some googling and there doesn’t seem to be a standard answer for this. There’s but it only lets you write performance tests, it doesn’t seem like it lets you just run something and give a breakdown of which functions took the most time.

There’s also VisualVM but there are conflicting reports on whether it works with scala or not.

Something that works with Intellij would be ideal.

Any ideas?

I’ve just tried VisualVM and its IntelliJ plugin, and that works pretty well.

It doesn’t seem to have a way to record time in specific functions, but it does let you see what’s taking up CPU / memory, and tracking usage might be a way to track the time in specific functions.

You should also try out these alternatives:

I think the best tool I’ve used so far is JProfiler, however the license is quite expensive. They do offer a 1 month free trial though. Also, the next version of IntelliJ is going to support flame graphs run from the IDE, which will be amazing!

@aliakhtar see

I wonder if my starter project for benchmark is helpful:

Please carefully read the README, and the FlameGraph part.

What’s so special about 2018, with regards to profiling code?

IntelliJ has a new experimental profiler, apparently. I don’t think it’s available on Windows (yet?), only Linux and Mac.