Bug 439009 - Single-click or Double-click on the variable is very slow on large files in Juno and Kepler
Summary: Single-click or Double-click on the variable is very slow on large files in J...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.1.2   Edit
Hardware: All Linux
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-07 06:13 EDT by csk 200 CLA
Modified: 2020-09-04 15:23 EDT (History)
2 users (show)

See Also:


Attachments
Thread dump taken immediately when I double-click on the variable. (27.08 KB, application/octet-stream)
2014-07-09 03:14 EDT, csk 200 CLA
no flags Details
Thread dump taken after 20 sec of double-click operation on a variable. (27.71 KB, application/octet-stream)
2014-07-09 03:15 EDT, csk 200 CLA
no flags Details
Thread dump taken after 40 sec of double-click operation on a variable. (28.37 KB, application/octet-stream)
2014-07-09 03:15 EDT, csk 200 CLA
no flags Details
Thread dump taken after the variable is highlighted on all occurrences. (24.14 KB, application/octet-stream)
2014-07-09 03:16 EDT, csk 200 CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description csk 200 CLA 2014-07-07 06:13:13 EDT
The below are the two scenarios in both Juno(8.1.2) and Kepler (8.3.0):

1. While modifying a large file (e.g., first.c) and if we try to single-click/double-click on the variables, it is taking nearly 1 min time to highlight all the occurrences. If my next action is marking other word, then it is very fast.(My successive markings are fast until I modify or type something in the file). Now If I type anything, again it repeats 1 min lag.

2. While modifying a large file, when we switch from this large file to another file, single-click/double-click on the variables are taking longer times to highlight them. My successive markings are fast until I switch to another file and back to large file. 


Below are the detailed steps that I followed to reproduce the problem.
a. Checked-out few large files, first.c, second.c.
b. Added few comments in first.c and didn't saved the latest comments.
c. Now double-clicked on one of the variable, 'DummyResGlobal'. It took 36 sec to highlight all the occurrences.
d. Again double-clicked on another variable 'NILPTR'. It took only 1 sec to highlight all the occurrences.
e. Now added few lines of code in first.c and double-clicked on 'DrvTblFncRet' variable which took 34 sec to highlight.
f. Switched to second.c and added some spaces there and came back to first.c. When I try to single-click on 'NILPTR', it took 36 sec to highlight.
Comment 1 csk 200 CLA 2014-07-07 07:49:31 EDT
It seems this problem is fixed in CDT (7.0) but not working in Juno(8.1.2) and Kepler (8.3.0).
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314635
Comment 2 Anton Leherbauer CLA 2014-07-08 03:45:07 EDT
Could you create a thread dump during the 1 min delay?
Details are here: https://wiki.eclipse.org/How_to_report_a_deadlock

From the description it sounds like the parser is slow on parsing the file, because the delay only occurs after a modification.
Comment 3 csk 200 CLA 2014-07-09 03:10:21 EDT

1.Eclipse Build:
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 2
Build id: 20140224-0627

2. Java Version and Vendor:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

3. Operation performed:
Double-clicking on a variable to highlight all the occurrences.

4. JVM configuration:
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.6
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-XX:MaxPermSize=512m
-Xms4096m
-Xmx4096m

5. RAM and SWAP info:
hysue801:sc186002--> free -g
             total       used       free     shared    buffers     cached
Mem:            70         67          3          0          0          5
-/+ buffers/cache:         62          8
Swap:          143          0        143


6. Reproducible Steps:
a. Checked-out few large files, first.c, second.c.
b. Added few comments in first.c and didn't saved the latest comments.
c. Now double-clicked on one of the variable, 'DummyResGlobal'. It took 36 sec to highlight all the occurrences.
d. Again double-clicked on another variable 'NILPTR'. It took only 1 sec to highlight all the occurrences.
e. Now added few lines of code in first.c and double-clicked on 'DrvTblFncRet' variable which took 34 sec to highlight.
f. Switched to second.c and added some spaces there and came back to first.c. When I try to single-click on 'NILPTR', it took 36 sec to highlight.


7. Enclosing four thread dumps taken with a gap of few seconds using jvisualvm.
 a. threaddump-1404887963632_just_after_double_click.tdump
 b. threaddump-1404887987358_after_20_sec.tdump
 c. threaddump-1404888009049_after_40_sec.tdump
 d. threaddump-1404888038222_after_highlight.tdump

Please let me know if you need any further info.

Thanks in advance.
Comment 4 csk 200 CLA 2014-07-09 03:14:10 EDT
Created attachment 244907 [details]
Thread dump taken immediately when I double-click on the variable.
Comment 5 csk 200 CLA 2014-07-09 03:15:18 EDT
Created attachment 244908 [details]
Thread dump taken after 20 sec of double-click operation on a variable.
Comment 6 csk 200 CLA 2014-07-09 03:15:54 EDT
Created attachment 244909 [details]
Thread dump taken after 40 sec of double-click operation on a variable.
Comment 7 csk 200 CLA 2014-07-09 03:16:52 EDT
Created attachment 244910 [details]
Thread dump taken after the variable is highlighted on all occurrences.
Comment 8 Anton Leherbauer CLA 2014-07-09 03:34:20 EDT
Thanks for the thread dumps.  It looks like semantic highlighting and codan checkers are using most of the time.
How large are the files in question?  For large files (by default 5000+ lines) we have the scalability mode to avoid those known performance issues.
Does it help to disable semantic highlighting in the preferences?
Comment 9 csk 200 CLA 2014-07-09 05:04:40 EDT
Thank you for your quick response.

The file has more than 40000 lines of code and the file size is more than 1.5MB. No performance issues for the smaller files (1000 lines).

Disabled the semantic highlighting but it doesn't help.

Enabled the scalability mode when the number of lines in the file is more than 50000. Increasing or decreasing this scalability value also did not solve the performance problem.
Comment 10 Anton Leherbauer CLA 2014-07-09 05:35:06 EDT
(In reply to csk 200 from comment #9)
> Enabled the scalability mode when the number of lines in the file is more
> than 50000. Increasing or decreasing this scalability value also did not
> solve the performance problem.

Of course you should set the value to something lower than your file size. Try the default of 5000 lines.
Note that you have to close and reopen the file for the scalability options to take effect.
Comment 11 csk 200 CLA 2014-07-09 05:56:20 EDT
(In reply to Anton Leherbauer from comment #10)
> (In reply to csk 200 from comment #9)
> > Enabled the scalability mode when the number of lines in the file is more
> > than 50000. Increasing or decreasing this scalability value also did not
> > solve the performance problem.
> 
> Of course you should set the value to something lower than your file size.
> Try the default of 5000 lines.
> Note that you have to close and reopen the file for the scalability options
> to take effect.

No change in the performance even for default 5000 lines. Yes, I'm closing and reopening the file and verifying. Actually to avoid the scalability popup, we set to bigger number in the preferences.
Comment 12 Anton Leherbauer CLA 2014-07-11 03:01:31 EDT
(In reply to csk 200 from comment #11)
> No change in the performance even for default 5000 lines.
Note that with default scalability settings, in particular disabled live-parsing, you loose also the mark occurrences feature. I.e. it is no surprise that occurrences are not highlighted in this case.
If you instead disable only semantic highlighting (but keep live-parsing enabled), mark occurrences should still work.

> Actually to avoid the scalability
> popup, we set to bigger number in the preferences.
But that also defeats the purpose of the scalability mode.  You can avoid the popup without changing the number of lines limit.
Comment 13 csk 200 CLA 2014-07-14 06:27:34 EDT
(In reply to Anton Leherbauer from comment #12)
> If you instead disable only semantic highlighting (but keep live-parsing
> enabled), mark occurrences should still work.
Still the mark occurrences takes 30 to 40sec.

> But that also defeats the purpose of the scalability mode.  You can avoid
> the popup without changing the number of lines limit.
How to avoid the popup?
Comment 14 csk 200 CLA 2014-07-14 10:18:01 EDT
Can we expect any patch/fix for this performance issue?