Bug 342473 - [reconcile] Optimize operation of Java reconciler when build operation is triggered.
Summary: [reconcile] Optimize operation of Java reconciler when build operation is tri...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-11 13:12 EDT by Ayushman Jain CLA
Modified: 2011-04-13 02:46 EDT (History)
4 users (show)

See Also:


Attachments
call stack to show reconcilation by breadcrumbs (3.47 KB, text/plain)
2011-04-12 08:22 EDT, Ayushman Jain CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-04-11 13:12:31 EDT
The java reconciler comes into play while the user types code and while the compilation process has not kicked in yet to generate the class file. This works fine when the user is writing code but if he presses CTRL+S (auto-build enabled) or triggers a build manually, two threads - the compiler and the Java reconciler - start to parse, resolve, analyse code and build ASTs together. This process is wasteful as far as the Java reconciler is concerned. If the AST is all that it needs, perhaps the compiler can return it as it is to the reconciler.

We should think of better strategies to remove this redundancy at compile time. Filing this bug initially in JDT/UI to get everyone's opinion. May be moved to JDT/Core if needed.
Comment 1 Dani Megert CLA 2011-04-12 05:47:29 EDT
Good idea. The reconciler already tries to detect the 'save' delta and ignore it but obviously not good enough. In order to solve this bug we need a flag (combination) that uniquely identifies a save operation. It looks like this is mostly {CONTENT | FINE GRAINED | PRIMARY RESOURCE} but I'm not sure this directly maps to 'save'.

Moving to JDT Core for a follow-up.
Comment 2 Ayushman Jain CLA 2011-04-12 06:00:10 EDT
(In reply to comment #1)
> Good idea. The reconciler already tries to detect the 'save' delta and ignore
> it but obviously not good enough. In order to solve this bug we need a flag
> (combination) that uniquely identifies a save operation. It looks like this is
> mostly {CONTENT | FINE GRAINED | PRIMARY RESOURCE} but I'm not sure this
> directly maps to 'save'.

How will a flag in JDT/Core help the reconciler? Does the reconciler wait for any input from the compiler?
Comment 3 Dani Megert CLA 2011-04-12 06:02:42 EDT
> How will a flag in JDT/Core help the reconciler? Does the reconciler wait for
> any input from the compiler?
The reconciler also handles deltas (e.g. to update problems when a related CU changed). If the delta is a 'save' on X then the reconciler for X can ignore that delta.
Comment 4 Ayushman Jain CLA 2011-04-12 07:12:16 EDT
Btw, just for the sake of documentation, we should also check that we dont do the double operation in cases when there is a syntax error and the resource is just edited and not saved. I think the build operation keeps on getting triggered in such a case.
For example, while debugging Parser.parse() for
class Test {
   void f() {
      synchronized new Object();
   }
}

I saw that even pressing a space starts the parsing in both reconciler and compiler threads. I don't know if the flag combination of such a scenario will be different from the save operation.
Comment 5 Ayushman Jain CLA 2011-04-12 07:30:32 EDT
(In reply to comment #4)
> I saw that even pressing a space starts the parsing in both reconciler and
> compiler threads. I don't know if the flag combination of such a scenario will
> be different from the save operation.

Satyam showed that wasn't really the compiler and the reconciler but two reconcile operations. One was being triggered by the breadcumbs view. Again, this is strange. Can't the breadcrumbs view make use of the reconcile operation already happening?
Comment 6 Dani Megert CLA 2011-04-12 08:02:41 EDT
> One was being triggered by the breadcumbs view. Again,
> this is strange. Can't the breadcrumbs view make use of the reconcile operation already happening?
The breadcrumb view doesn't trigger a reconcile.
Comment 7 Ayushman Jain CLA 2011-04-12 08:22:20 EDT
Created attachment 193039 [details]
call stack to show reconcilation by breadcrumbs

See the attached callstack. Breadcumbs are surely in the picture here.
Comment 8 Dani Megert CLA 2011-04-12 08:27:44 EDT
That is not directly related to the breadcrumb. It can happen at any time we need the model in reconciled state (but no AST is needed).

See also bug 266299 and bug 265220.
Comment 9 Ayushman Jain CLA 2011-04-13 02:46:08 EDT
Jay, can you please follow up on comment 1. Thanks!