Task #1666
TBX: improve performances of tokenizing process
| Statut: | Closed | Début: | 10/02/2016 | |
|---|---|---|---|---|
| Priorité: | Normal | Echéance: | ||
| Assigné à: | - | % réalisé: | 100% |
|
| Catégorie: | Import | Temps passé: | - | |
| Version cible: | TXM 0.7.8 |
Description
Some improvements may be done in the Groovy code of tokenizing sections.
Streams¶
Wrap FileOutputStreams with BufferedOutputStreams.
Compiling REGEX patterns¶
- compile all REGEX patterns that are used in Groovy scripts (use "= ~")
- e.g. replace from: reg3pts = /\A(.*)(\.\.\.)(.*)\Z/ to: reg3pts = ~/\A(.*)(\.\.\.)(.*)\Z/
- also compile the patterns used in replaceAll(), split(), etc. then call these methods from the Matcher class itself rather than the String class
- see Pattern.compile() for Java code sections
Use static Groovy compilation to avoid the runtime reflection¶
see:
- import groovy.transform.CompileStatic
- import static groovy.transform.TypeCheckingMode.SKIP
- @CompileStatic
- @CompileStatic(SKIP) => may be used when we can't statically compiling the script because of Groovy syntax usage. But a better solution is to remove the Groovy syntax to statically compile
- add @CompileStatic before "public class SimpleTokenizerXml" in SimpleTokenizer.groovy
- edit protected String standardChecks(String s) so it can be statically compiled
- compile all reg3pts, regPunct, etc. member patterns using "= ~" instead of "="
- extract the split pattern of split(), replaceAll() and matches() methods and store them compiled as member, eg.:
regSplitWhiteSpaces = Pattern.compile(TokenizerClasses.whitespaces);
regLN = Pattern.compile("/\n/");
regCTRL = Pattern.compile("/\\p{C}/");
Historique
#1 Mis à jour par Sebastien Jacquot il y a plus de 9 ans
- Tâche parente mis à #1630
#2 Mis à jour par Matthieu Decorde il y a plus de 9 ans
- Description mis à jour (diff)
#3 Mis à jour par Matthieu Decorde il y a plus de 9 ans
- Description mis à jour (diff)
#4 Mis à jour par Matthieu Decorde il y a plus de 9 ans
- % réalisé changé de 0 à 50
#5 Mis à jour par Matthieu Decorde il y a plus de 9 ans
- % réalisé changé de 50 à 60
#6 Mis à jour par Matthieu Decorde il y a plus de 9 ans
- % réalisé changé de 60 à 80
vérification du bon déroulement des modules d'import du menu import
#7 Mis à jour par Sebastien Jacquot il y a presque 2 ans
- Statut changé de New à Closed
#8 Mis à jour par Sebastien Jacquot il y a presque 2 ans
- % réalisé changé de 80 à 100
#9 Mis à jour par Sebastien Jacquot il y a plus d'un an
- Tâche parente
#1630supprimé