This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 183151 - Counting change when a file is a big takes long time
Summary: Counting change when a file is a big takes long time
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: PC All
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2010-03-30 07:08 UTC by Petr Pisl
Modified: 2010-04-02 04:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2010-03-30 07:08:09 UTC
If you reformat bigger file the finding all changes tooks longer time. As example it can be tcpdf.php file from http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf . Finding changes on this file takes more than 25 seconds, inserting changes more about one minute. The use is able to work with the editor after 2 minutes and 36 seconds after invoking format action.
Comment 1 Petr Pisl 2010-03-30 07:47:16 UTC
The issue can be separated into three parts:
1) finding all needed changes
2) insert changes into the document
3) update all features like code folding, syntax and semantic coloring ...

Current formatter is implemented in the way that it has to go trough the file twice. At first to find the changes, applying the formatting changes and then second round is the indentation of the file. 

The current time for tcpdf are:

Finding formatter changes: 1745 ms
Insert the changes to the document: 35 765 ms
Indenting the formatted document: 37 549 ms

Format action took: 75 402 ms
User is able to work with the document after updating all features after 2 minutes and 17 seconds.

When then is pressed Undo action and formatting is executed again the times are:

Finding formatter changes: 2154 ms
Insert the changes to the document: 78 259 ms
Indenting the formatted document: 69 387 ms

Format action took: 150 170ms
User is able to work with the document after updating all features after 3 minutes and 32 seconds.

The second formatting is slower, because the Undo front is bigger (the document remember also the changes from the previous formatting).
Comment 2 Petr Pisl 2010-03-30 09:30:01 UTC
The solution is rewrite the formatter that will format a file only in one round. So it will at least save the time that it's needed for indentation.

The new formatter is faster and the times measured during formating tcpdf.php at first time:

Finding formatter changes: 386 ms
Insert the changes to the document: 19 610 ms

Format action took: 20 710 ms
User is able to work with the document after updating all features after 51 seconds.

After invoking Undo action and formatting the file again the times are:

Finding formatter changes: 293 ms
Insert the changes to the document: 47 640 ms

Format action took: 47 947 ms
User is able to work with the document after updating all features after 1 minute and 25 seconds.


The new formatter is committed into webmain
Comment 3 Quality Engineering 2010-04-02 04:53:23 UTC
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c072349f8703
User: Petr Pisl <ppisl@netbeans.org>
Log: #183151 -  Counting change when a file is a big takes long time

Basically it introduce new PHP formatter