Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369106 - Slow typing in big php files – multiline statements indentation performance optimization
Summary: Slow typing in big php files – multiline statements indentation performance o...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Natalia Bartol CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-19 11:26 EST by Natalia Bartol CLA
Modified: 2020-05-14 11:17 EDT (History)
2 users (show)

See Also:


Attachments
Multiline statement indentation improvement - patch (6.67 KB, patch)
2012-01-19 11:45 EST, Natalia Bartol CLA
jacek.pospychala: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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