You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/10/15 03:37:13 UTC

[GitHub] b-slim closed pull request #6459: Reducing the usage of Jmh Invocation level on setup

b-slim closed pull request #6459: Reducing the usage of Jmh Invocation level on setup
URL: https://github.com/apache/incubator-druid/pull/6459
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/benchmarks/src/main/java/org/apache/druid/benchmark/LoadStatusBenchmark.java b/benchmarks/src/main/java/org/apache/druid/benchmark/LoadStatusBenchmark.java
deleted file mode 100644
index 0bc82f5024a..00000000000
--- a/benchmarks/src/main/java/org/apache/druid/benchmark/LoadStatusBenchmark.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.druid.benchmark;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.druid.java.util.common.Intervals;
-import org.apache.druid.java.util.common.StringUtils;
-import org.apache.druid.timeline.DataSegment;
-import org.apache.druid.timeline.partition.NoneShardSpec;
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Fork;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Param;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.Warmup;
-import org.openjdk.jmh.infra.Blackhole;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
-@State(Scope.Benchmark)
-@Fork(value = 1)
-@Warmup(iterations = 15)
-@Measurement(iterations = 30)
-public class LoadStatusBenchmark
-{
-  // Number of total data segments
-  @Param({"10000"})
-  int totalSegmentsCount;
-
-  @Param({"true", "false"})
-  private boolean serverHasAllSegments;
-
-  private Set<DataSegment> datasourceSegments;
-  private Collection<DataSegment> serverSegments;
-
-  @Setup(Level.Invocation)
-  public void setup()
-  {
-    Map<String, DataSegment> immutableDatasourceSegmentsMap;
-    ConcurrentHashMap<String, DataSegment> serverSegmentsMap;
-
-    HashMap<String, DataSegment> datasourceSegmentsMap = Maps.newHashMap();
-    serverSegmentsMap = new ConcurrentHashMap<>();
-
-    for (int i = 0; i < totalSegmentsCount; i++) {
-      DataSegment segment = new DataSegment(
-          "benchmarkDatasource",
-          Intervals.of(StringUtils.format("%s-01-01/%s-12-31", i + 1970, i + 1970)),
-          "1",
-          null,
-          null,
-          null,
-          NoneShardSpec.instance(),
-          1,
-          1
-      );
-
-      datasourceSegmentsMap.put(segment.getIdentifier(), segment);
-
-      if (serverHasAllSegments || i % 2 == 0) {
-        serverSegmentsMap.put(segment.getIdentifier(), segment);
-      }
-    }
-
-    immutableDatasourceSegmentsMap = ImmutableMap.copyOf(datasourceSegmentsMap);
-
-    datasourceSegments = Sets.newHashSet(immutableDatasourceSegmentsMap.values());
-    serverSegments = Collections.unmodifiableCollection(serverSegmentsMap.values());
-  }
-
-  @Benchmark
-  @BenchmarkMode(Mode.AverageTime)
-  @OutputTimeUnit(TimeUnit.MICROSECONDS)
-  public void oldVersion(Blackhole blackhole)
-  {
-    datasourceSegments.removeAll(serverSegments);
-    blackhole.consume(datasourceSegments);
-  }
-
-  @Benchmark
-  @BenchmarkMode(Mode.AverageTime)
-  @OutputTimeUnit(TimeUnit.MICROSECONDS)
-  public void newVersion(Blackhole blackhole)
-  {
-    for (DataSegment segment : serverSegments) {
-      datasourceSegments.remove(segment);
-    }
-    blackhole.consume(datasourceSegments);
-  }
-}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org