@@ -0,0 +1,1753 @@
+/*%0A * Copyright (C) 2014 The Guava Authors%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may not use this file except%0A * in compliance with the License. You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage com.google.common.io;%0A%0Aimport com.google.caliper.BeforeExperiment;%0Aimport com.google.caliper.Benchmark;%0Aimport com.google.caliper.Param;%0A%0Aimport java.util.Random;%0A%0A/**%0A * Benchmark for %7B@code BaseEncoding%7D performance.%0A */%0Apublic class BaseEncodingBenchmark %7B%0A  enum EncodingOption %7B%0A    BASE64(BaseEncoding.base64()),%0A    BASE64_URL(BaseEncoding.base64Url()),%0A    BASE32(BaseEncoding.base32()),%0A    BASE32_HEX(BaseEncoding.base32Hex()),%0A    BASE16(BaseEncoding.base16());%0A    %0A    final BaseEncoding encoding;%0A    %0A    EncodingOption(BaseEncoding encoding) %7B%0A      this.encoding = encoding;%0A    %7D%0A  %7D%0A  %0A  @Param%0A  EncodingOption encoding;%0A  %0A  @Param(%7B%2210%22, %22100%22, %2210000%22%7D)%0A  int n;%0A  %0A  private final byte%5B%5D%5B%5D inputs = new byte%5B0x1000%5D%5B%5D;%0A%0A  @BeforeExperiment%0A  public void setUp() %7B%0A    Random rng = new Random();%0A    for (int i = 0; i %3C inputs.length; i++) %7B%0A      inputs%5Bi%5D = new byte%5Bn%5D;%0A      rng.nextBytes(inputs%5Bi%5D);%0A    %7D%0A  %7D%0A  %0A  @Benchmark public int encode(int reps) %7B%0A    int tmp = 0;%0A    for (int i = 0; i %3C reps; i++) %7B%0A      tmp += System.identityHashCode(encoding.encoding.encode(inputs%5Bi & 0xFFF%5D));%0A    %7D%0A    return tmp;%0A  %7D%0A%7D%0A

Add benchmark for BaseEncoding. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=81099316