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.
If you try to indent a bigger files with more lines you'll observe that most of the indentation time is spent in AI.calculateLineIndent() cloning arrays. There's the allCommands ArrayList containing the indent commands for all which is cloned for each line. So for long files with many lines this is unefficient. My testing 50 000 lines css file used to be formatted for ~ 22seconds (no diffs application, already formatted code) where ~20 seconds used to be spent in the mentioned method cloning arrays.
I've made a simple patch which solves the problem - extendable-only list backed by the original list. Since the allCommands list doesn't seem to escape from the method context, the solution seems safe to me. web-main#c53d70e57e41 Davide, please review the change carefully! Thanks.
Integrated into 'main-golden', will be available in build *201104020400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/c53d70e57e41 User: Marek Fukala <mfukala@netbeans.org> Log: #197324 - AbstractIndenter line indent calculation algorithm does too much arrays cloning
(In reply to comment #0) > where ~20 seconds used to be spent in the mentioned method cloning arrays. Cool! Thanks major improvement. Thanks for doing that. I had a look at the code and run some unit tests and it looks perfectly OK.