Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368944 - Slow typing in big php files – LineStyleProviderForPhp performance optimization
Summary: Slow typing in big php files – LineStyleProviderForPhp performance optimization
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-18 06:47 EST by Natalia Bartol CLA
Modified: 2020-05-14 11:18 EDT (History)
2 users (show)

See Also:


Attachments
Creating text presentation for php script region improved (24.93 KB, patch)
2012-01-18 07:06 EST, Natalia Bartol CLA
no flags Details | Diff
Creating text presentation for php script region improved II (25.62 KB, patch)
2012-01-18 10:48 EST, Natalia Bartol CLA
no flags Details | Diff
Creating text presentation for php script region improved III (25.65 KB, patch)
2012-01-18 12:33 EST, Natalia Bartol CLA
no flags Details | Diff
Creating text presentation for php script region improved IV (25.42 KB, patch)
2012-01-19 08:17 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-18 06:47:06 EST
Build Identifier: 

Typing in big php files (>25k lines of code) that consist of only one <php?> … </php> region is really slow.  
Main cause is that after every keystroke whole php region of structured editor is updated. This includes examining all php tokens and applying new line styles. In most cases file modification doesn’t cause the php script region to be fully reparsed. Only the affected tokens are reparsed and properly updated. The same approach should be used when it comes to providing line style: only affected tokens should be examined  in the process of syntax colouring.


Reproducible: Always
Comment 1 Natalia Bartol CLA 2012-01-18 07:06:06 EST
Created attachment 209671 [details]
Creating text presentation for php script region improved

Attached patch modifies the creation of text presentation for a php script region that has not been fully reparsed. Created presentation covers now only affected php tokens, what gives performance boost when typing. 

Affected classes:
IPhpScriptRegion – methods added to get recently updated tokens

PhpScriptRegion – methods added to get recently updated tokens. Synchronization on phpTokens added in updateRegion method to avoid concurrent modification exception when the reconciling background thread calls phpTokens.getToken() 

PhpTokenContainer – synchronized keyword added to few methods to avoid concurrent modification exception

PHPStructuredTextViewer – removed line region.setFullReparsed(true); as information that region is not fully reparsed is required in LineStyleProviderForPhp

PHPStructuredPresentationReconciler – modified creation of text presentation for damaged php script region that is not fully reparsed

StructuredDocumentDamagerRepairer – method returning presentation added which covers only updated php tokens in case when the damage covers whole PHP region and this regions has not been fully reparsed

LineStyleProviderForPhp – using only updated php tokens when creating line styles
Comment 2 Natalia Bartol CLA 2012-01-18 10:48:48 EST
Created attachment 209682 [details]
Creating text presentation for php script region improved II

One more improvement in creating text presentation for updated php region. Deals with the case where damaged typed region is smaller than corresponding php script region.
Comment 3 Natalia Bartol CLA 2012-01-18 12:33:06 EST
Created attachment 209696 [details]
Creating text presentation for php script region improved III

A bug fixed in created text presentation range.
Comment 4 Natalia Bartol CLA 2012-01-19 08:17:38 EST
Created attachment 209744 [details]
Creating text presentation for php script region improved IV

Patch improved: more efficient way of creating text presentation in StructuredDocumentDamageRepairer.
Comment 5 Jacek Pospychala CLA 2012-01-20 03:16:21 EST
fixed by Natalia

great work!
Comment 6 Sylvia Tancheva CLA 2012-07-05 09:43:29 EDT
Verified. Closing
Ilina Stefanova