Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 134722 Details for
Bug 273157
[performance] ManifestAnalyzer is causing a 2x performance drop in the updating of classpath of JavaProjects in comparison with 3.4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_273157.txt (text/plain), 8.77 KB, created by
Olivier Thomann
on 2009-05-06 21:16:41 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-05-06 21:16:41 EDT
Size:
8.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java,v >retrieving revision 1.5 >diff -u -r1.5 ManifestAnalyzer.java >--- compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 21 Apr 2009 11:08:20 -0000 1.5 >+++ compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 7 May 2009 01:15:33 -0000 >@@ -10,10 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.util; > >-import java.io.BufferedReader; > import java.io.IOException; > import java.io.InputStream; >-import java.io.InputStreamReader; > import java.util.ArrayList; > import java.util.List; > >@@ -41,122 +39,127 @@ > * @throws IOException if an exception occurs while analyzing the file > */ > public boolean analyzeManifestContents(InputStream inputStream) throws IOException { >- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Util.UTF_8)); >- try { >- int state = START, substate = 0; >- StringBuffer currentJarToken = new StringBuffer(); >- int currentChar; >- this.classpathSectionsCount = 0; >- this.calledFilesNames = null; >- for (;;) { >- currentChar = reader.read(); >- if (currentChar == '\r') // skip \r, will consider \n later (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=251079 ) >- currentChar = reader.read(); >- switch (state) { >- case START: >- if (currentChar == -1) { >- return true; >- } else if (currentChar == CLASSPATH_HEADER_TOKEN[0]) { >- state = IN_CLASSPATH_HEADER; >- substate = 1; >- } else { >- state = SKIP_LINE; >- } >- break; >- case IN_CLASSPATH_HEADER: >- if (currentChar == -1) { >- return true; >- } else if (currentChar == '\n') { >- state = START; >- } else if (currentChar != CLASSPATH_HEADER_TOKEN[substate++]) { >- state = SKIP_LINE; >- } else if (substate == CLASSPATH_HEADER_TOKEN.length) { >- state = PAST_CLASSPATH_HEADER; >- } >- break; >- case PAST_CLASSPATH_HEADER: >- if (currentChar == ' ') { >- state = SKIPPING_WHITESPACE; >- this.classpathSectionsCount++; >- } else { >- return false; >- } >- break; >- case SKIPPING_WHITESPACE: >- if (currentChar == -1) { >- // >>>>>>>>>>>>>>>>>> Add the latest jar read >- addCurrentTokenJarWhenNecessary(currentJarToken); >- return true; >- } else if (currentChar == '\n') { >- state = CONTINUING; >- } else if (currentChar != ' ') { >- currentJarToken.append((char) currentChar); >- state = READING_JAR; >- } else { >- // >>>>>>>>>>>>>>>>>> Add the latest jar read >- addCurrentTokenJarWhenNecessary(currentJarToken); >- } >- break; >- case CONTINUING: >- if (currentChar == -1) { >- // >>>>>>>>>>>>>>>>>> Add the latest jar read >- addCurrentTokenJarWhenNecessary(currentJarToken); >- return true; >- } else if (currentChar == '\n') { >- addCurrentTokenJarWhenNecessary(currentJarToken); >- state = START; >- } else if (currentChar == ' ') { >- state = SKIPPING_WHITESPACE; >- } else if (currentChar == CLASSPATH_HEADER_TOKEN[0]) { >- addCurrentTokenJarWhenNecessary(currentJarToken); >- state = IN_CLASSPATH_HEADER; >- substate = 1; >- } else if (this.calledFilesNames == null) { >- // >>>>>>>>>>>>>>>>>> Add the latest jar read >- addCurrentTokenJarWhenNecessary(currentJarToken); >- state = START; >- } else { >- // >>>>>>>>>>>>>>>>>> Add the latest jar read >- addCurrentTokenJarWhenNecessary(currentJarToken); >- state = SKIP_LINE; >- } >- break; >- case SKIP_LINE: >- if (currentChar == -1) { >- if (this.classpathSectionsCount != 0) { >- if (this.calledFilesNames == null) { >- return false; >- } >- } >- return true; >- } else if (currentChar == '\n') { >- state = START; >- } >- break; >- case READING_JAR: >- if (currentChar == -1) { >- // >>>>>>>>>>>>>>>>>> Add the latest jar read >- return false; >- } else if (currentChar == '\n') { >- // appends token below >- state = CONTINUING; >- // >>>>>>>>>>> Add a break to not add the jar yet as it can continue on the next line >- break; >- } else if (currentChar == ' ') { >- // appends token below >- state = SKIPPING_WHITESPACE; >- } else { >- currentJarToken.append((char) currentChar); >- break; >- } >- addCurrentTokenJarWhenNecessary(currentJarToken); >- break; >+ char[] chars = Util.getInputStreamAsCharArray(inputStream, -1, Util.UTF_8); >+ int state = START, substate = 0; >+ StringBuffer currentJarToken = new StringBuffer(); >+ int currentChar; >+ this.classpathSectionsCount = 0; >+ this.calledFilesNames = null; >+ for (int i = 0, max = chars.length; i < max;) { >+ currentChar = chars[i++]; >+ if (currentChar == '\r') { >+ // skip \r, will consider \n later (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=251079 ) >+ if (i < max) { >+ currentChar = chars[i++]; > } > } >- } finally { >- reader.close(); >+ switch (state) { >+ case START: >+ if (currentChar == CLASSPATH_HEADER_TOKEN[0]) { >+ state = IN_CLASSPATH_HEADER; >+ substate = 1; >+ } else { >+ state = SKIP_LINE; >+ } >+ break; >+ case IN_CLASSPATH_HEADER: >+ if (currentChar == '\n') { >+ state = START; >+ } else if (currentChar != CLASSPATH_HEADER_TOKEN[substate++]) { >+ state = SKIP_LINE; >+ } else if (substate == CLASSPATH_HEADER_TOKEN.length) { >+ state = PAST_CLASSPATH_HEADER; >+ } >+ break; >+ case PAST_CLASSPATH_HEADER: >+ if (currentChar == ' ') { >+ state = SKIPPING_WHITESPACE; >+ this.classpathSectionsCount++; >+ } else { >+ return false; >+ } >+ break; >+ case SKIPPING_WHITESPACE: >+ if (currentChar == '\n') { >+ state = CONTINUING; >+ } else if (currentChar != ' ') { >+ currentJarToken.append((char) currentChar); >+ state = READING_JAR; >+ } else { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ } >+ break; >+ case CONTINUING: >+ if (currentChar == '\n') { >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ state = START; >+ } else if (currentChar == ' ') { >+ state = SKIPPING_WHITESPACE; >+ } else if (currentChar == CLASSPATH_HEADER_TOKEN[0]) { >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ state = IN_CLASSPATH_HEADER; >+ substate = 1; >+ } else if (this.calledFilesNames == null) { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ state = START; >+ } else { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ state = SKIP_LINE; >+ } >+ break; >+ case SKIP_LINE: >+ if (currentChar == '\n') { >+ state = START; >+ } >+ break; >+ case READING_JAR: >+ if (currentChar == '\n') { >+ // appends token below >+ state = CONTINUING; >+ // >>>>>>>>>>> Add a break to not add the jar yet as it can continue on the next line >+ break; >+ } else if (currentChar == ' ') { >+ // appends token below >+ state = SKIPPING_WHITESPACE; >+ } else { >+ currentJarToken.append((char) currentChar); >+ break; >+ } >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ break; >+ } >+ } >+ switch (state) { >+ case START: >+ return true; >+ case IN_CLASSPATH_HEADER: >+ return true; >+ case PAST_CLASSPATH_HEADER: >+ return false; >+ case SKIPPING_WHITESPACE: >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ return true; >+ case CONTINUING: >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); >+ return true; >+ case SKIP_LINE: >+ if (this.classpathSectionsCount != 0) { >+ if (this.calledFilesNames == null) { >+ return false; >+ } >+ } >+ return true; >+ case READING_JAR: >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ return false; > } >- } >+ return true; >+ } > > // >>>>>>>>>>>>>>>> Method Extracted from analyzeManifestContents in the READING_JAR Block > private boolean addCurrentTokenJarWhenNecessary(StringBuffer currentJarToken) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 273157
:
134302
|
134303
| 134722