Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369106

Summary: Slow typing in big php files – multiline statements indentation performance optimization
Product: z_Archived Reporter: Natalia Bartol <natalia.bartol>
Component: PDTAssignee: Natalia Bartol <natalia.bartol>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jacek.pospychala, silviya
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Multiline statement indentation improvement - patch jacek.pospychala: iplog+

Description Natalia Bartol CLA 2012-01-19 11:26:08 EST
Build Identifier: 

Auto indentation takes a lot of time when typing in big php files. Indentation algorithm checks if current statement is a multiline one, i.e. variable assignment like

$x = new a(“b”, “c”, “d”,|
“e”, “f”);

In such case PHPHeuristicScanner searches for unmatched opening bracket. Currently the problem is that the whole document may be searched for opening bracket if the statement is not a multiline one. Scanning is performed from current offset backwards up to the beginning of the document, what is inefficient. 


Reproducible: Always
Comment 1 Natalia Bartol CLA 2012-01-19 11:45:11 EST
Created attachment 209755 [details]
Multiline statement indentation improvement - patch

Improvements in attached patch:
1. Two new region types have been added to DefaultIndentationStrategy.isRegionTypeAllowedMultiline(regionType) method: PHP_LINE_COMMENT and PHP_STRING.
2. In PHPHeuristicScanner.findOpeningPeer parameter int bound has been added. Scanning backward stops when bound position is reached.
3. DefaultIndentationStrategy.inMultiline() uses findOpeningPeer with proper bound parameter.
Comment 2 Jacek Pospychala CLA 2012-01-20 03:17:42 EST
fixed by Natalia

great work!
Comment 3 Natalia Bartol CLA 2012-01-25 08:01:55 EST
Fix applied by Jacek.
Comment 4 Sylvia Tancheva CLA 2012-07-06 02:40:48 EDT
Verified. Closing
Ilina Stefanova