Ignore:
Timestamp:
07/30/13 09:44:39 (11 years ago)
Author:
pharms
Message:
  • improved performance of task instance trie generation by using different symbol management strategies while creating the trie. This performance improvement is significant and allows to detect tasks now in a much faster manner.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskComparator.java

    r1256 r1285  
    1919import java.util.HashMap; 
    2020 
    21 import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2221import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2322import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    24 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    25 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2823import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2924import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     
    3934     
    4035    /** */ 
    41     private static final int MAX_BUFFER_SIZE = 10 * 1024 * 1024; 
     36    private static final int MAX_BUFFER_SIZE = 2 * 1024 * 1024; 
    4237 
    4338    /** */ 
     
    7974         
    8075        if (task1 != task2) { 
    81             if ((task1 instanceof IEventTask) && (task2 instanceof IEventTask)) { 
     76            //if ((task1 instanceof IEventTask) && (task2 instanceof IEventTask)) { 
    8277                long key = ((long) System.identityHashCode(task1)) << 32; 
    8378                key += System.identityHashCode(task2); 
     
    9287                    } 
    9388                } 
    94             } 
     89            /*} 
    9590            else { 
    9691                result = false; 
    97             } 
     92            }*/ 
    9893        } 
    9994        else { 
     
    118113            if (result == null) { 
    119114                result = lexicalComparer.compare(task1, task2); 
    120                 if (equalityBuffer.size() < 1024 * 1024 * 10) { 
     115                if (equalityBuffer.size() < MAX_BUFFER_SIZE) { 
    121116                    lexicalEqualityBuffer.put(key, result); 
    122117                } 
     
    130125    } 
    131126     
    132     /* (non-Javadoc) 
    133      * @see SymbolComparator#getBucketSearchOrder(Object) 
    134      */ 
    135     @Override 
    136     public int[] getBucketSearchOrder(ITaskInstance taskInstance) { 
    137         // 0 = sequence; 1 = selection; 2 = iteration; 3 = optional; 4 = event task in general; 
    138         // other = hashCode of name of event type 
    139          
    140         ITask task = taskInstance.getTask(); 
    141          
    142         if (task instanceof IEventTask) { 
    143             // event tasks are most likely equal to those of the event type with the same name, 
    144             // Afterwards, they may be equal to iterations, optionals, other event tasks, 
    145             // selections, and finally the rest. 
    146             IEventType eventType = ((IEventTask) task).getEventType(); 
    147             return new int[] { eventType.getName().hashCode(), 2, 3, 4, 1 };                        
    148         } 
    149         else if (task instanceof ISequence) { 
    150             return new int[] { 0, 2, 3, 1 };                        
    151         } 
    152         else if (task instanceof ISelection) { 
    153             return new int[] { 1, 4, 2, 3 };                        
    154         } 
    155         else if (task instanceof IIteration) { 
    156             return new int[] { 2, 1, 4 };                        
    157         } 
    158          
    159         return null; 
    160     } 
    161  
     127    /** 
     128     * <p> 
     129     * TODO: comment 
     130     * </p> 
     131     * 
     132     */ 
     133    void clearBuffers() { 
     134        equalityBuffer.clear(); 
     135        init(); 
     136    } 
     137     
    162138    /** 
    163139     *  
     
    275251        } 
    276252    } 
     253 
    277254} 
Note: See TracChangeset for help on using the changeset viewer.