Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 376796 - [chain] completion times out on most occasions
Summary: [chain] completion times out on most occasions
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Henss CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-14 03:19 EDT by Deepak Azad CLA
Modified: 2019-07-24 14:36 EDT (History)
4 users (show)

See Also:


Attachments
screenshot (84.89 KB, image/png)
2012-04-14 03:19 EDT, Deepak Azad CLA
no flags Details
Result in AdvancedQuickAssistProcessor.getAddParenthesesForExpressionProposals (155.81 KB, image/png)
2012-05-05 15:04 EDT, Marcel Bruch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2012-04-14 03:19:38 EDT
Created attachment 214006 [details]
screenshot

I was trying to use it in org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor to how the feature works. On most occasions I hit a timeout. Though I did get it to work on one or two occasions, which means the installation and settings are probably OK.

As shown in the screenshot I was trying to get an AST, in some methods that works and in others it doesn't. e.g. it works everytime in AdvancedQuickAssistProcessor.getIfReturnIntoIfElseAtEndOfVoidMethodProposals(...) but never in AdvancedQuickAssistProcessor.getAddParenthesesForExpressionProposals(...)

- Do you need more information from me?
- Is there somewhere I can increase the timeout for Call Chain completion engine?
Comment 1 Marcel Bruch CLA 2012-04-14 04:18:06 EDT
Thanks Deepak.  The screenshot and description provides enough information to reproduce, I guess. I'll go for this issue after the 18th. Also Stefan will join again the 23rd. He will probably migrate the chain completion to use the compiler ast and make some performance addition to the algorithm itself.
Comment 2 Deepak Azad CLA 2012-04-14 04:24:32 EDT
So there is no way to increase the timeout?
Comment 3 Marcel Bruch CLA 2012-04-14 04:34:40 EDT
There are two timeouts:

1. JDT's timeout of 4 or 5 seconds
2. our internal timeout after 3.5 seconds for building the callchain graph.

This timeout is hardcoded in

org.eclipse.recommenders.internal.completion.rcp.chain.ChainCompletionProposalComputer.executeCallChainSearch()

and can be changed in source code only ATM. Do you want to dig deeper into this issue?
Comment 4 Deepak Azad CLA 2012-04-14 04:57:15 EDT
(In reply to comment #3)
> There are two timeouts:
> 
> 1. JDT's timeout of 4 or 5 seconds
The only configurable timeout in JDT is for fetching parameter name from attached javadoc, so that does not help here.

> 2. our internal timeout after 3.5 seconds for building the callchain graph.
> 
> This timeout is hardcoded in
Making this configurable might be an option if the performance cannot be improved significantly..

I can wait for this bug to be fixed, and in the meanwhile continue to try the feature in more situations.
Comment 5 Marcel Bruch CLA 2012-04-24 03:56:28 EDT
Stefan just signed up to take care of call chain completion.

Just for completeness, here the minutes of the meeting what needs to to be done:

higher priority:

* stop early: Currently, the complete graph is build before search is done. Make the graph builder stop early as soon as the required type is found.

* use compiler ast representation instead of JavaElements as recommended by Dani.

* try without using a thread pool. I'm not sure we gain a lot when using it (actually we may have even more overhead than gain). However, performance is key :) 



Lower priority:

* configurable timeout: hardcoded atm. Make it configurable via preference page

* configurable max chain depth: hardcoded atm. Make it configurable via preference page

* "stop-types": are hardcoded. Make them configurable via preference page (e.g., no search should be triggered for java.lang.String)

* support for generics: not yet supported. would be nice if List<String> l = $ would actually return types with the right generics.


Stefan, please update this bug as soon as the higher priority issues are adressed and the engine is ready for manual tests - or you have any thoughts on the implementation.

Thanks,
Marcel
Comment 6 Marcel Bruch CLA 2012-05-05 07:04:52 EDT
chains only support public members. It may be useful to support package/protected/private methods too - if visibility permits. Mostly the visibility checks have to be implemented
Comment 7 Marcel Bruch CLA 2012-05-05 15:04:02 EDT
Created attachment 215131 [details]
Result in AdvancedQuickAssistProcessor.getAddParenthesesForExpressionProposals

Stefan refined the algorithm and remove the thread pool. It seems that performance improved much (although he removed the thread pool). 

Deepak, can you give the latest dev build a try to see if it works for you now in your scenarios and machine?
Comment 8 Marcel Bruch CLA 2012-05-05 15:07:00 EDT
Deepak, how much performance gain do you think can we expect from working on the compiler ast instead of working on the IJavaElements?
Comment 9 Deepak Azad CLA 2012-05-07 04:30:16 EDT
(In reply to comment #7)
> Deepak, can you give the latest dev build a try to see if it works for you now
> in your scenarios and machine?

It feels a bit better, though I did hit the timeout a few times. I guess I will use this for a week or so and see how does it work in real scenarios.

A couple of (minor) comments about functionality
- You cannot use subwords to filter proposals here :-)
- In the screenshot from comment 7, notice the proposals where the first element is a local variable/parameter i.e. the 3rd from top - coveringNode.getAST() and 4th from bottom - node.getAST(). I was a bit surprised that these are far apart in the list. I can see that alphabetical sort is used but I was expecting these to be bunched together since the first element is local variable...
Comment 10 Andreas Sewe CLA 2014-03-31 04:02:03 EDT
Has been open a long time; will close this for now as I haven't heard complaints recently (maybe computers just good fast enough in the meantime. ;-).
Comment 11 Andreas Sewe CLA 2014-04-01 08:28:47 EDT
Released Code Recommenders 2.0.7.