Changeset 967


Ignore:
Timestamp:
Mar 2, 2014, 4:41:56 PM (11 years ago)
Author:
s10k
Message:

XmlTools
Some more little optimizations and updated readme

Location:
XmlTools2/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XmlTools2/trunk/optionsparser.cpp

    r955 r967  
    9797
    9898                if(line.startsWith('"')){ // Only read when starting with quotes
    99                     temp=line.split(" \""); // We need to use more than space, because if paths contains spaces...
    100                     patchFiles << temp[0].remove('"'); // remove the quotes, they are now not needed
    101                     targetXmlFiles << temp[1].remove('"');
     99                    temp=line.split('"',QString::SkipEmptyParts); // We need to use more than space, because if paths contains spaces...
     100                    patchFiles << temp[0];
     101                    targetXmlFiles << temp[2]; // space is in idx 1
    102102                }
    103103            }
     
    106106
    107107            // Now let's process each patch file and target file
    108             //#pragma omp parallel for
    109108            for(int i=0; i<patchFiles.size(); i++){
    110109                XmlPatch myXmlPatch(patchFiles[i],targetXmlFiles[i],true,true); // use --no-backups and --no-verbose for AEI
  • XmlTools2/trunk/readme.txt

    r961 r967  
    6262Change Log:
    6363----------------------------------
    64 2.0a, 20-02-2014
     642.0a, 02-03-2014
    6565-Added multithreading support for @CUSTOM_COMMAND, use wildcards in multiple files for the same js code to
    66 take advantage of this (performance may increase over 2.5 times)
     66take advantage of this (performance may increase over 3 times for a quadcore)
    6767-Now a warning is given if a user javascript code (@CUSTOM_COMMAND) takes too much time to finish
    6868-Fixed small bug when applying patches with @COMMAND + --no-verbose where some std output should not be displayed
  • XmlTools2/trunk/util.h

    r964 r967  
    5252}
    5353
    54 // Needs optimization
     54//TODO Needs optimization
    5555inline QStringList QStringToArgsArray(const QString &args){
    5656    QStringList result;
  • XmlTools2/trunk/xmlcustomcode.cpp

    r964 r967  
    3737            // alternatively you can do: myFunc=engine.evaluate('(function main(){})'); myFunc.call();
    3838            // Note the () around the function
    39             this->getXmlDataFunctions.append(new QScriptValue(this->scriptEngines[i]->evaluate("(function getXmlData() { return $xmlData; })")));
    40             this->setXmlDataFunctions.append(new QScriptValue(this->scriptEngines[i]->evaluate("(function setXmlData(newXmlData) { $xmlData=newXmlData; })")));
     39            this->getXmlDataFunctions.append(new QScriptValue(this->scriptEngines.at(i)->evaluate("(function getXmlData() { return $xmlData; })")));
     40            this->setXmlDataFunctions.append(new QScriptValue(this->scriptEngines.at(i)->evaluate("(function setXmlData(newXmlData) { $xmlData=newXmlData; })")));
    4141
    4242            // Add echo function so user can debug the code
    43             QScriptValue echoFunction = this->scriptEngines[i]->newFunction(echo);
    44             this->scriptEngines[i]->globalObject().setProperty("echo", echoFunction);
     43            QScriptValue echoFunction = this->scriptEngines.at(i)->newFunction(echo);
     44            this->scriptEngines.at(i)->globalObject().setProperty("echo", echoFunction);
    4545
    4646            // Add the js library for XmlEditing
    47             this->scriptEngines[i]->evaluate(jsxmlString);
     47            this->scriptEngines.at(i)->evaluate(jsxmlString);
    4848        }
    4949    }
     
    5454    // Reconstruct script functions
    5555    for(int i=0; i<this->numThreads; i++){
    56         *this->jsFunctions[i]=this->scriptEngines[i]->evaluate("(function main() {"+jsString+"})");
     56        *this->jsFunctions[i]=this->scriptEngines.at(i)->evaluate("(function main() {"+jsString+"})");
    5757    }
    5858
     
    6363    clock_t begin; // seconds that a script started
    6464
    65     // Single tread if small files
     65    // Single tread if small number of files
    6666    if(filesToProcess.size()<CUSTOM_FILES_PER_THREAD){
    6767        // Process all XmlFiles
    6868        for(int i=0; i<filesToProcess.size(); i++){
    6969
    70             customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines[0],begin,elapsed_secs,engineResult,
    71                     *this->jsFunctions[0],*this->getXmlDataFunctions[0],*this->setXmlDataFunctions[0],backupsEnabled,verboseEnabled);
     70            customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines.at(0),begin,elapsed_secs,engineResult,
     71                    *this->jsFunctions.at(0),*this->getXmlDataFunctions.at(0),*this->setXmlDataFunctions.at(0),backupsEnabled,verboseEnabled);
    7272        }
    7373    }
     
    8585            clock_t beginThread; // seconds that a script started
    8686
    87             customCodeUnwinding(filesToProcess.at(i),currXmlFileStringThread,*this->scriptEngines[tid],beginThread,elapsedSecsThread,engineResultThread,
    88                                 *this->jsFunctions[tid],*this->getXmlDataFunctions[tid],*this->setXmlDataFunctions[tid],backupsEnabled,verboseEnabled);
     87            customCodeUnwinding(filesToProcess.at(i),currXmlFileStringThread,*this->scriptEngines.at(tid),beginThread,elapsedSecsThread,engineResultThread,
     88                                *this->jsFunctions.at(tid),*this->getXmlDataFunctions.at(tid),*this->setXmlDataFunctions.at(tid),backupsEnabled,verboseEnabled);
    8989
    90             customCodeUnwinding(filesToProcess.at(i+1),currXmlFileStringThread,*this->scriptEngines[tid],beginThread,elapsedSecsThread,engineResultThread,
    91                                 *this->jsFunctions[tid],*this->getXmlDataFunctions[tid],*this->setXmlDataFunctions[tid],backupsEnabled,verboseEnabled);
     90            customCodeUnwinding(filesToProcess.at(i+1),currXmlFileStringThread,*this->scriptEngines.at(tid),beginThread,elapsedSecsThread,engineResultThread,
     91                                *this->jsFunctions.at(tid),*this->getXmlDataFunctions.at(tid),*this->setXmlDataFunctions.at(tid),backupsEnabled,verboseEnabled);
    9292        }
    9393
     
    9898            for(int i=alreadyProcessedFiles; i<filesToProcess.size(); i++){
    9999
    100                 customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines[0],begin,elapsed_secs,engineResult,
    101                         *this->jsFunctions[0],*this->getXmlDataFunctions[0],*this->setXmlDataFunctions[0],backupsEnabled,verboseEnabled);
     100                customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines.at(0),begin,elapsed_secs,engineResult,
     101                        *this->jsFunctions.at(0),*this->getXmlDataFunctions.at(0),*this->setXmlDataFunctions.at(0),backupsEnabled,verboseEnabled);
    102102            }
    103103        }
  • XmlTools2/trunk/xmlpatch.cpp

    r964 r967  
    230230    QString line, patchVersion="";
    231231
    232     // First get the patch version and check it validity
     232    // First get the patch version and check its validity
    233233    while ( !fileStream.atEnd() ){
    234234        line = fileStream.readLine();
Note: See TracChangeset for help on using the changeset viewer.