scala-ide / scala-ide-play2

Play 2 support for Scala IDE
107 stars 32 forks source link

Hyperlinking in routes is too slow #204

Open dotta opened 10 years ago

dotta commented 10 years ago

I'm using v0.4.1 with a 3 years old Mac Book Pro (2.4Ghz dualcore Intel Core i5), and hyperlinking in routes is extremely slow, to the point that I don't think I'll take advantage of the feature.

You can try to reproduce the problem by opening the routes file in the Reactive Stocks Activator template. Below are two thread-dumps taken by Svelto after two consecutive hyperlinking requests (the second one took more than 11seconds!)

================================================================================
[Fri Feb 14 15:32:56 CET 2014] UI Thread blocked for 6,539 milliseconds. Thread dump follows.
================================================================================
"main" Id=1 TIMED_WAITING on scala.tools.nsc.interactive.Response@1836b345
    at java.lang.Object.wait(Native Method)
    -  waiting on scala.tools.nsc.interactive.Response@1836b345
    at scala.tools.nsc.interactive.Response.get(Response.scala:74)
    at scala.tools.eclipse.ScalaPresentationCompiler.askOption(ScalaPresentationCompiler.scala:146)
    at scala.tools.eclipse.ScalaPresentationCompiler.askOption(ScalaPresentationCompiler.scala:137)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2.apply(RouteHyperlinkComputer.scala:23)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2.apply(RouteHyperlinkComputer.scala:21)
    at scala.tools.eclipse.ScalaProject$$anonfun$withPresentationCompiler$1.apply(ScalaProject.scala:595)
    at scala.tools.eclipse.ScalaProject$$anonfun$withPresentationCompiler$1.apply(ScalaProject.scala:594)
    at scala.tools.eclipse.util.Cached$class.apply(Cached.scala:41)
    at scala.tools.eclipse.ScalaProject$$anon$1.apply(ScalaProject.scala:95)
    at scala.tools.eclipse.ScalaProject.withPresentationCompiler(ScalaProject.scala:594)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkComputer.scala:84)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkComputer.scala:19)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$.detectHyperlinks(RouteHyperlinkComputer.scala:18)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkDetector$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkDetector.scala:17)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkDetector$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkDetector.scala:16)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkDetector.detectHyperlinks(RouteHyperlinkDetector.scala:15)
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
    -  locked [Lorg.eclipse.jface.text.hyperlink.IHyperlinkDetector;@34d5dbc
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)

"Scala Presentation Compiler [reactive-stocks]" Id=36 RUNNABLE
    at java.lang.Character.toLowerCase(Character.java:6148)
    at java.lang.Character.toLowerCase(Character.java:6119)
    at java.lang.String.toLowerCase(String.java:2430)
    at java.lang.String.toLowerCase(String.java:2524)
    at java.net.URL.<init>(URL.java:377)
    at org.eclipse.osgi.framework.util.SecureAction.getURL(SecureAction.java:348)
    at org.eclipse.osgi.baseadaptor.bundlefile.BundleFile.internalGetResourceURL(BundleFile.java:158)
    at org.eclipse.osgi.baseadaptor.bundlefile.BundleFile.getResourceURL(BundleFile.java:146)
    at org.eclipse.osgi.baseadaptor.bundlefile.BundleFileWrapperChain.getResourceURL(BundleFileWrapperChain.java:63)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findResourceImpl(ClasspathManager.java:361)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalResourceImpl(ClasspathManager.java:310)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalResource(ClasspathManager.java:297)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalResource(DefaultClassLoader.java:208)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalResource(BundleLoader.java:820)
    at org.eclipse.osgi.internal.loader.BundleLoader.findResource(BundleLoader.java:624)
    at org.eclipse.osgi.internal.loader.BundleLoader.findResource(BundleLoader.java:577)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.getResource(DefaultClassLoader.java:143)
    at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1348)
    at java.lang.Class.getResourceAsStream(Class.java:2098)
    at org.eclipse.jdt.internal.compiler.parser.Parser.readTable(Parser.java:744)
    at org.eclipse.jdt.internal.compiler.parser.Parser.initTables(Parser.java:585)
    at org.eclipse.jdt.internal.compiler.parser.Parser.<clinit>(Parser.java:124)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.initialize(MatchLocator.java:1052)
    at org.eclipse.jdt.internal.core.search.matching.SuperTypeNamesCollector.collect(SuperTypeNamesCollector.java:202)
    at org.eclipse.jdt.internal.core.search.matching.MethodLocator.initializePolymorphicSearch(MethodLocator.java:119)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1240)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:95)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:231)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
    at org.scalaide.play2.routeeditor.hyperlink.MethodFinder.doSearch(MethodFinder.scala:39)
    at org.scalaide.play2.routeeditor.hyperlink.MethodFinder.searchMethod(MethodFinder.scala:31)
    at org.scalaide.play2.routeeditor.hyperlink.MethodFinder.searchMethod(MethodFinder.scala:27)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1$$anonfun$6.apply(RouteHyperlinkComputer.scala:69)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1$$anonfun$6.apply(RouteHyperlinkComputer.scala:66)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1.apply(RouteHyperlinkComputer.scala:65)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1.apply(RouteHyperlinkComputer.scala:23)
    at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26)
    -  locked scala.tools.nsc.util.WorkScheduler$$anon$1@5ebdf128
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:339)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)
================================================================================
[Fri Feb 14 15:41:41 CET 2014] UI Thread blocked for 11,163 milliseconds. Thread dump follows.
================================================================================
"main" Id=1 TIMED_WAITING on scala.tools.nsc.interactive.Response@7200a341
    at java.lang.Object.wait(Native Method)
    -  waiting on scala.tools.nsc.interactive.Response@7200a341
    at scala.tools.nsc.interactive.Response.get(Response.scala:74)
    at scala.tools.eclipse.ScalaPresentationCompiler.askOption(ScalaPresentationCompiler.scala:146)
    at scala.tools.eclipse.ScalaPresentationCompiler.askOption(ScalaPresentationCompiler.scala:137)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2.apply(RouteHyperlinkComputer.scala:23)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2.apply(RouteHyperlinkComputer.scala:21)
    at scala.tools.eclipse.ScalaProject$$anonfun$withPresentationCompiler$1.apply(ScalaProject.scala:595)
    at scala.tools.eclipse.ScalaProject$$anonfun$withPresentationCompiler$1.apply(ScalaProject.scala:594)
    at scala.tools.eclipse.util.Cached$class.apply(Cached.scala:41)
    at scala.tools.eclipse.ScalaProject$$anon$1.apply(ScalaProject.scala:95)
    at scala.tools.eclipse.ScalaProject.withPresentationCompiler(ScalaProject.scala:594)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkComputer.scala:84)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkComputer.scala:19)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$.detectHyperlinks(RouteHyperlinkComputer.scala:18)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkDetector$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkDetector.scala:17)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkDetector$$anonfun$detectHyperlinks$1.apply(RouteHyperlinkDetector.scala:16)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkDetector.detectHyperlinks(RouteHyperlinkDetector.scala:15)
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
    -  locked [Lorg.eclipse.jface.text.hyperlink.IHyperlinkDetector;@34d5dbc
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)

"Scala Presentation Compiler [reactive-stocks]" Id=36 RUNNABLE
    at java.lang.System.arraycopy(Native Method)
    at org.eclipse.core.runtime.Path.uptoSegment(Path.java:1009)
    at org.eclipse.jdt.internal.core.SourceMapper.computeAllRootPaths(SourceMapper.java:562)
    -  locked org.eclipse.jdt.internal.core.SourceMapper@1ddc4b5a
    at org.eclipse.jdt.internal.core.SourceMapper.findSource(SourceMapper.java:1012)
    at org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getContents(PossibleMatch.java:73)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9918)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9890)
    at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:8454)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.parseAndBuildBindings_aroundBody0(MatchLocator.java:1651)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator$AjcClosure1.run(MatchLocator.java:1)
    at scala.tools.eclipse.contribution.weaving.jdt.search.SearchAspect.ajc$around$scala_tools_eclipse_contribution_weaving_jdt_search_SearchAspect$1$d9eec72bproceed(SearchAspect.aj:1)
    at scala.tools.eclipse.contribution.weaving.jdt.search.SearchAspect.ajc$around$scala_tools_eclipse_contribution_weaving_jdt_search_SearchAspect$1$d9eec72b(SearchAspect.aj:32)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.parseAndBuildBindings(MatchLocator.java:1642)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1079)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1184)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1316)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:95)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:231)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
    at org.scalaide.play2.routeeditor.hyperlink.MethodFinder.doSearch(MethodFinder.scala:39)
    at org.scalaide.play2.routeeditor.hyperlink.MethodFinder.searchMethod(MethodFinder.scala:31)
    at org.scalaide.play2.routeeditor.hyperlink.MethodFinder.searchMethod(MethodFinder.scala:27)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1$$anonfun$6.apply(RouteHyperlinkComputer.scala:69)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1$$anonfun$6.apply(RouteHyperlinkComputer.scala:66)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1.apply(RouteHyperlinkComputer.scala:65)
    at org.scalaide.play2.routeeditor.hyperlink.RouteHyperlinkComputer$$anonfun$detectHyperlinks$1$$anonfun$2$$anonfun$apply$1.apply(RouteHyperlinkComputer.scala:23)
    at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26)
    -  locked scala.tools.nsc.util.WorkScheduler$$anon$1@269ed733
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:339)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)
dotta commented 10 years ago

This seems to be happening in particular for hyperlinking in Java source files