Closed ghostbuster91 closed 3 years ago
We just found out that adding diffx to one of our tests increased compile time from 9s to 37s. Most of the time spent in macro expansion and typer (magnolia?). So diffx is out for now...
That's an interesting turn of events, as magnolia was supposed to help exactly with that problem ;) But maybe the code we're generating is somehow complex to typecheck?
some details on compiler perf for the module that got slowed down:
[info] time spent in implicits : 26298 spans, ()40685.324ms (97,1%)
[info] successful in scope : 4602 spans, ()34438.572ms (82,2%)
[info] failed in scope : 21696 spans, ()15615.766ms (37,3%)
[info] successful of type : 6005 spans, ()40204.231ms (96,0%)
[info] failed of type : 15691 spans, ()195.332ms (0,5%)
[info] assembling parts : 605 spans, ()2892.693ms (6,9%)
[info] matchesPT : 51482 spans, ()174.387ms (0,4%)
[info] time spent in macroExpand : 8636 spans, ()34019.755ms (81,2%)
the test has about 10 cases doing play json ast diffs
@francisdb Could you give some example of how big are your case classes?
Hmm, some quite elaborate play json JsObject object, maybe comparable to this https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/intro-to-tweet-json#quotetweet (and using the workaround provided in #14 )
It would be great to have some benchmarks run on CI so we won't introduce regression after we fix it. Here are some inspirations:
Offtopic: @francisdb we are using https://github.com/gnieh/diffson for diffing json ast's and it's working very well for us
@francisdb are you maybe also using the silencer plugin? See https://github.com/ghik/silencer/issues/45 why I suspect this might be connected :)
Nope, we were not using that plugin
Well, was worth a shot ;)
Hi, I know that it's been a while but finally I managed to fix it to certain degree. It turned out that switching from auto to semi-auto derivation drastically decreases compilation time, so from this time onward this will be the recommended way to use diffx.
Closing as semi-auto solves that problem.
Write some performance tests to measure various things. Maybe look at magnolia tests for inspiration?
This article might be helpful while debugging: http://www.lsug.co.uk/workshop/scala/2019/07/21/workshop-run-scalac-run.html