コード例 #1
0
 public void measureGetAll(PerformanceMeter meter) {
   fTextStore.set(FAUST1);
   int length = fTextStore.getLength();
   meter.start();
   for (int times = 0; times < 500; times++) fTextStore.get(0, length);
   meter.stop();
 }
コード例 #2
0
 public void measureTypingReplaceInSmallFile(PerformanceMeter meter) {
   fTextStore.set(FAUST500);
   int offset = 12;
   meter.start();
   for (int times = 0; times < 9000000; times++)
     while (offset++ < 400) fTextStore.replace(offset, 0, ";");
   meter.stop();
 }
コード例 #3
0
 public void measureGetChar(PerformanceMeter meter) {
   fTextStore.set(FAUST1);
   int length = fTextStore.getLength();
   meter.start();
   for (int times = 0; times < 150; times++)
     for (int offset = 0; offset < length; offset++) fTextStore.get(offset);
   meter.stop();
 }
コード例 #4
0
 public void measureRepeatedReplace(PerformanceMeter meter) {
   fTextStore.set(FAUST1);
   int OFFSET = 12;
   int REPLACE_LENGTH = FAUST100.length();
   meter.start();
   for (int times = 0; times < 200000; times++)
     fTextStore.replace(OFFSET, REPLACE_LENGTH, FAUST100);
   meter.stop();
 }
コード例 #5
0
 public void measureInsertAtEnd(PerformanceMeter meter) {
   fTextStore.set("");
   int offset = fTextStore.getLength();
   int length = FAUST100.length();
   meter.start();
   for (int times = 0; times < 3000; times++) {
     fTextStore.replace(offset, 0, FAUST100);
     offset += length;
   }
   meter.stop();
 }
コード例 #6
0
 public void measureDeleteInsert(PerformanceMeter meter) {
   fTextStore.set(FAUST1);
   int OFFSET = 12;
   int REPLACE_LENGTH = 100;
   meter.start();
   for (int times = 0; times < 1000; times++)
     // delete phase
     fTextStore.replace(OFFSET, REPLACE_LENGTH, null);
   for (int times = 0; times < 1000; times++)
     // insert phase
     fTextStore.replace(OFFSET, 0, FAUST100);
   meter.stop();
 }
コード例 #7
0
 public void measureGetLine(PerformanceMeter meter) throws BadLocationException {
   fTextStore.set(FAUST1);
   ILineTracker tracker = new DefaultLineTracker();
   tracker.set(FAUST1);
   int lines = tracker.getNumberOfLines();
   meter.start();
   for (int times = 0; times < 100; times++) {
     for (int line = 0; line < lines; line++) {
       IRegion lineInfo = tracker.getLineInformation(line);
       fTextStore.get(lineInfo.getOffset(), lineInfo.getLength());
     }
   }
   meter.stop();
 }
コード例 #8
0
  public void measureRandomReplace(PerformanceMeter meter) {
    fTextStore.set(FAUST1);

    Random rand = new Random(132498029834234L);
    int[] indices = new int[1000];
    int REPLACE_LENGTH = 100; // chosen to fit in the gap text store size
    for (int i = 0; i < indices.length; i++)
      indices[i] = rand.nextInt(FAUST1.length() - REPLACE_LENGTH);
    char[] replacement = new char[REPLACE_LENGTH];
    Arrays.fill(replacement, ' ');
    String replace = new String(replacement);

    meter.start();
    for (int times = 0; times < 4; times++)
      for (int i = 0; i < indices.length; i++) {
        fTextStore.replace(indices[i], REPLACE_LENGTH, null);
        fTextStore.replace(indices[i], 0, replace);
      }
    meter.stop();
  }
コード例 #9
0
 public void measureSet(PerformanceMeter meter) {
   meter.start();
   for (int accumulated = 0; accumulated < 400; accumulated++) fTextStore.set(FAUST1);
   meter.stop();
 }
コード例 #10
0
 public void measureInsertAtStart(PerformanceMeter meter) {
   fTextStore.set(FAUST1);
   meter.start();
   for (int times = 0; times < 1000; times++) fTextStore.replace(0, 0, FAUST100);
   meter.stop();
 }