Package com.cloudera.util

Examples of com.cloudera.util.Benchmark.done()


    b.mark("begin");
    for (int i = 0; i < times; i++) {
      base.getBytes();
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringToWrapByteBuffer() {
    Benchmark b = new Benchmark("String wrap ByteBuf");
View Full Code Here


    b.mark("begin");
    for (int i = 0; i < times; i++) {
      ByteBuffer.wrap(base.getBytes());
    }
    b.mark("after " + times);
    b.done();

  }

  @Test
  public void testStringtoByteBufferCopy() {
View Full Code Here

      byte[] buf = base.getBytes();
      ByteBuffer bb = ByteBuffer.allocate(buf.length);
      bb.put(buf);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringToByteArray2() {
    Benchmark b = new Benchmark("String to ByteArray");
View Full Code Here

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      base.getBytes();
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringToWrapByteBuffer2() {
    Benchmark b = new Benchmark("String wrap ByteBuf");
View Full Code Here

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      ByteBuffer.wrap(base.getBytes());
    }
    b.mark("after " + times);
    b.done();

  }

  @Test
  public void testStringtoByteBufferCopy2() {
View Full Code Here

      byte[] buf = base.getBytes();
      ByteBuffer bb = ByteBuffer.allocate(buf.length);
      bb.put(buf);
    }
    b.mark("after " + times);
    b.done();
  }

}
View Full Code Here

    for (int i = 0; i < times; i++) {
      @SuppressWarnings("unused")
      String temp = base + i;
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringBufferAppend() {
    StringBuffer buf = new StringBuffer(base);
View Full Code Here

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      buf.append(i);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringBuilderAppend() {
    StringBuilder buf = new StringBuilder(base);
View Full Code Here

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      buf.append(i);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringFormat() {
    String format = "%s%d";
View Full Code Here

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      String.format(format, base, i);
    }
    b.mark("after " + times);
    b.done();

  }

  @Test
  public void testStringAppend2() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.