jonnybot0 commented on issue #15293:
URL: https://github.com/apache/grails-core/issues/15293#issuecomment-3712253386

   I took a look at this today after reviewing a thread on the Groovy mailing 
list. I ran the Grails applications with IntelliJ's Async Profiler.
   
   Based on the profiler, it looked like the vast majority of the time sink 
came from the `grails7.performance.PerformanceTestService#getProjectMetrics` 
method. Specifically, all the calls to the Groovy collector methods took a big 
hit. Pardon the screenshots in this comment, as I ran different numbers of 
iterations in each trial, so the millisecond counts will vary, but the order of 
magnitude relative to the top line method should give you an idea of the 
relative slowdown.
   
   Grails 7 hot path:
   <img width="995" height="1320" alt="grails-7-hot-path" 
src="https://github.com/user-attachments/assets/25a5757b-45be-4349-a638-8744d923e6b6";
 />
   
   Grails 6 hot path:
   <img width="1138" height="1180" alt="grails-6-hot-path" 
src="https://github.com/user-attachments/assets/4829dca2-b855-4745-b993-07e5746ad88d";
 />
   
   For each of those collection methods, IntelliJ jumped to 
`java.lang.invoke.Invokers$Holder#linkToCallSite(java.lang.Object, 
java.lang.Object)` and 
`java.lang.invoke.Invokers$Holder#linkToCallSite(java.lang.Object, 
java.lang.Object, java.lang.Object)` when I clicked the profiler link on the 
left. That's where most of the time is getting consumed, which is consistent 
with the Invoke Dynamic being the principal performance tank.
   
   As a test, I tried replacing those method calls with Java stream operators 
(see [my 
branch](https://github.com/jglapa/grails7-performance-regression/compare/master...jonnybot0:grails7-performance-regression:avoid-collector-methods-for-complex-analysis?expand=1)).
 Performance did not change much at all, because we still ended up spending a 
lot of time in 
`java.lang.invoke.Invokers$Holder#linkToCallSite(java.lang.Object, 
java.lang.Object, java.lang.Object)`.
   
   That does strongly suggest that all the hibernate stuff Grails is doing 
(such as in `Projects.list`) is basically fine. It also suggests that _most_ of 
what Groovy is doing is also performing fine, since a lot of the slowdown is 
traceable to the `grails7.performance.PerformanceTestService#getProjectMetrics` 
method.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to