scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Scala 2 forwardport: `-Yprofile-trace`

Open WojciechMazur opened this issue 1 year ago • 5 comments

  • Scala 2 tracing profiler backport from https://github.com/scala/scala/pull/7364 extended with more Scala 3 idiomatic syntax based on inlined methods
  • Fixes the context.profiler which could have been null, now it's initially a NoOp Profiler
  • Check dependencies of -Yprofile-enabled dependent tasks, now we get an error if -Yprofile-trace is set without -Yprofile-enabled

WojciechMazur avatar Mar 07 '24 17:03 WojciechMazur

@keynmol petition here

bishabosha avatar Apr 05 '24 11:04 bishabosha

YES YES YES PLEASE This would be so much better than the several formats currently enabled by 3 different flags

keynmol avatar Apr 05 '24 11:04 keynmol

@nicolasstucki I think you we're doing the original backport of Profiler from Scala 2. Can you take a look at this and make a review?

WojciechMazur avatar Apr 11 '24 09:04 WojciechMazur

I generated the profile for

enum Foo:
  case A
  case B
  case C

and got the following result

Screenshot 2024-04-18 at 10 52 36

All metrics (except for GC) are missing in the type phase.

nicolasstucki avatar Apr 18 '24 08:04 nicolasstucki

The metrics are collected after the CompilationUnit with at least 10ms intervals. Parser used overriden runOn method that didn't run onUnit callback. Becouse there was only 1 compilation unit it seemed like collection of metrics started after the typer. In fact it works the same in Scala 2, but I've fixed to collect initial results in the constructor of the profiler - now we got statistics from the very beginning of the compilation run image

WojciechMazur avatar May 03 '24 11:05 WojciechMazur

I needed to rebase the PR which is not good news for the reviewing. The improvements after the first review round start with https://github.com/scala/scala3/pull/19897/commits/592a892f245133053c548f73dd5e4c1d636770a4

WojciechMazur avatar Sep 13 '24 11:09 WojciechMazur

test performance please

WojciechMazur avatar Sep 23 '24 14:09 WojciechMazur

performance test scheduled: 1 job(s) in queue, 1 running.

dottybot avatar Sep 23 '24 14:09 dottybot

Performance test finished successfully:

Visit https://dotty-bench.epfl.ch/19897/ to see the changes.

Benchmarks is based on merging with main (3097a84d0a)

dottybot avatar Sep 23 '24 14:09 dottybot