From f6173edc0594a905807824e294586ae3246db395 Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Wed, 5 Jan 2022 21:59:10 +0800 Subject: [PATCH] - optimize benchmark use `@Param` --- .../me/ahoo/cosid/SegmentIdBenchmark.java | 8 ++-- cosid-example/build.gradle.kts | 2 +- .../cosid/jdbc/MySqlChainIdBenchmark.java | 33 ++++++--------- .../me/ahoo/cosid/jdbc/MySqlIdBenchmark.java | 27 +++++++------ .../me/ahoo/cosid/jdbc/state/JdkIdState.java | 33 --------------- .../jdbc/state/SegmentChainId1000State.java | 35 ---------------- .../jdbc/state/SegmentChainId100State.java | 35 ---------------- .../cosid/jdbc/state/SegmentChainIdState.java | 35 ---------------- .../cosid/jdbc/state/SegmentId1000State.java | 35 ---------------- .../cosid/jdbc/state/SegmentId100State.java | 35 ---------------- .../ahoo/cosid/jdbc/state/SegmentIdState.java | 35 ---------------- .../cosid/redis/RedisChainIdBenchmark.java | 33 +++++++-------- .../me/ahoo/cosid/redis/RedisIdBenchmark.java | 28 +++++++------ .../me/ahoo/cosid/redis/state/JdkIdState.java | 33 --------------- .../redis/state/SegmentChainId1000State.java | 39 ------------------ .../redis/state/SegmentChainId100State.java | 39 ------------------ .../redis/state/SegmentChainIdState.java | 39 ------------------ .../cosid/redis/state/SegmentId1000State.java | 40 ------------------- .../cosid/redis/state/SegmentId100State.java | 40 ------------------- .../cosid/redis/state/SegmentIdState.java | 40 ------------------- document/deploy.sh | 2 +- 21 files changed, 62 insertions(+), 584 deletions(-) delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/JdkIdState.java delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId1000State.java delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId100State.java delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainIdState.java delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId1000State.java delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId100State.java delete mode 100644 cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentIdState.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/JdkIdState.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId1000State.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId100State.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainIdState.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId1000State.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId100State.java delete mode 100644 cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentIdState.java diff --git a/cosid-core/src/jmh/java/me/ahoo/cosid/SegmentIdBenchmark.java b/cosid-core/src/jmh/java/me/ahoo/cosid/SegmentIdBenchmark.java index cb9a96b7aa..70052f7079 100644 --- a/cosid-core/src/jmh/java/me/ahoo/cosid/SegmentIdBenchmark.java +++ b/cosid-core/src/jmh/java/me/ahoo/cosid/SegmentIdBenchmark.java @@ -37,11 +37,11 @@ public class SegmentIdBenchmark { SegmentId segmentId; SegmentChainId segmentChainId; - AtomicLongGenerator jdkId; + AtomicLongGenerator atomicLongGenerator; @Setup public void setup() { - jdkId = new AtomicLongGenerator(); + atomicLongGenerator = new AtomicLongGenerator(); segmentId = new DefaultSegmentId(new IdSegmentDistributor.Mock()); segmentChainId = new SegmentChainId(TIME_TO_LIVE_FOREVER, 10, new IdSegmentDistributor.Mock(), PrefetchWorkerExecutorService.DEFAULT); } @@ -52,8 +52,8 @@ public UUID uuid_generate() { } @Benchmark - public long jdkId_generate() { - return jdkId.generate(); + public long atomicLong_generate() { + return atomicLongGenerator.generate(); } @Benchmark diff --git a/cosid-example/build.gradle.kts b/cosid-example/build.gradle.kts index fdf7b38730..175de4a55d 100644 --- a/cosid-example/build.gradle.kts +++ b/cosid-example/build.gradle.kts @@ -94,8 +94,8 @@ dependencies { implementation("com.google.guava:guava") implementation("org.springframework.boot:spring-boot-starter-web") compileOnly("org.projectlombok:lombok:${rootProject.ext.get("lombokVersion")}") - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:${rootProject.ext.get("springBootVersion")}") annotationProcessor("org.projectlombok:lombok:${rootProject.ext.get("lombokVersion")}") + annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:${rootProject.ext.get("springBootVersion")}") testImplementation("org.springframework.boot:spring-boot-starter-test") } diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlChainIdBenchmark.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlChainIdBenchmark.java index 826561ba7c..7520f47541 100644 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlChainIdBenchmark.java +++ b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlChainIdBenchmark.java @@ -13,35 +13,28 @@ package me.ahoo.cosid.jdbc; -import me.ahoo.cosid.jdbc.state.JdkIdState; -import me.ahoo.cosid.jdbc.state.SegmentChainId1000State; -import me.ahoo.cosid.jdbc.state.SegmentChainId100State; -import me.ahoo.cosid.jdbc.state.SegmentChainIdState; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Threads; +import me.ahoo.cosid.segment.SegmentChainId; +import org.openjdk.jmh.annotations.*; /** * @author ahoo wang */ +@State(Scope.Benchmark) public class MySqlChainIdBenchmark { - @Benchmark - public long atomicLong_baseline(JdkIdState jdkIdState) { - return jdkIdState.jdkId.generate(); - } + @Param({"1", "100", "1000"}) + private int step; - @Benchmark - @Threads(2) - public long step_1(SegmentChainIdState segmentChainIdState) { - return segmentChainIdState.segmentId.generate(); - } - @Benchmark - public long step_100(SegmentChainId100State segmentChainId100State) { - return segmentChainId100State.segmentId.generate(); + SegmentChainId segmentChainId; + + @Setup + public void setup() { + segmentChainId = DataSourceFactory.INSTANCE.createSegmentChainId(step); } + @Benchmark - public long step_1000(SegmentChainId1000State segmentChainId1000State) { - return segmentChainId1000State.segmentId.generate(); + public long generate() { + return segmentChainId.generate(); } } diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlIdBenchmark.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlIdBenchmark.java index 35931b7efb..5c0304cc9d 100644 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlIdBenchmark.java +++ b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/MySqlIdBenchmark.java @@ -13,27 +13,28 @@ package me.ahoo.cosid.jdbc; -import me.ahoo.cosid.jdbc.state.*; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Threads; +import me.ahoo.cosid.segment.SegmentId; +import org.openjdk.jmh.annotations.*; /** * @author ahoo wang */ +@State(Scope.Benchmark) public class MySqlIdBenchmark { - @Benchmark - @Threads(2) - public long step_1(SegmentIdState segmentIdState) { - return segmentIdState.segmentId.generate(); - } - @Benchmark - public long step_100(SegmentId100State segmentId100State) { - return segmentId100State.segmentId.generate(); + @Param({"1", "100", "1000"}) + private int step; + + SegmentId segmentId; + + @Setup + public void setup() { + segmentId = DataSourceFactory.INSTANCE.createSegmentId(step); } + @Benchmark - public long step_1000(SegmentId1000State segmentId1000State) { - return segmentId1000State.segmentId.generate(); + public long generate() { + return segmentId.generate(); } } diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/JdkIdState.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/JdkIdState.java deleted file mode 100644 index 27c1e45185..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/JdkIdState.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jvm.AtomicLongGenerator; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class JdkIdState { - - public AtomicLongGenerator jdkId; - - @Setup - public void setup() { - jdkId = new AtomicLongGenerator(); - } -} diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId1000State.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId1000State.java deleted file mode 100644 index 953a0a7890..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId1000State.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jdbc.DataSourceFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentChainId1000State { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = DataSourceFactory.INSTANCE.createSegmentChainId(1000); - } - -} diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId100State.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId100State.java deleted file mode 100644 index 0d81876a39..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainId100State.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jdbc.DataSourceFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentChainId100State { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = DataSourceFactory.INSTANCE.createSegmentChainId(100); - } - -} diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainIdState.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainIdState.java deleted file mode 100644 index 2136084a5a..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentChainIdState.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jdbc.DataSourceFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentChainIdState { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = DataSourceFactory.INSTANCE.createSegmentChainId(1); - } - -} diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId1000State.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId1000State.java deleted file mode 100644 index 81d7c0e64f..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId1000State.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jdbc.DataSourceFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentId1000State { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = DataSourceFactory.INSTANCE.createSegmentId(1000); - } - -} diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId100State.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId100State.java deleted file mode 100644 index 280b8fe421..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentId100State.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jdbc.DataSourceFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentId100State { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = DataSourceFactory.INSTANCE.createSegmentId(100); - } - -} diff --git a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentIdState.java b/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentIdState.java deleted file mode 100644 index cf4121a8f5..0000000000 --- a/cosid-jdbc/src/jmh/java/me/ahoo/cosid/jdbc/state/SegmentIdState.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.jdbc.state; - -import me.ahoo.cosid.jdbc.DataSourceFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentIdState { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = DataSourceFactory.INSTANCE.createSegmentId(1); - } - -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisChainIdBenchmark.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisChainIdBenchmark.java index dd2fa58a62..1b98431b96 100644 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisChainIdBenchmark.java +++ b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisChainIdBenchmark.java @@ -13,11 +13,8 @@ package me.ahoo.cosid.redis; -import me.ahoo.cosid.redis.state.*; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.Threads; +import me.ahoo.cosid.segment.SegmentChainId; +import org.openjdk.jmh.annotations.*; /** * @author ahoo wang @@ -25,25 +22,23 @@ @State(Scope.Benchmark) public class RedisChainIdBenchmark { - @Benchmark - public long atomicLong_baseline(JdkIdState jdkIdState) { - return jdkIdState.jdkId.generate(); - } + @Param({"1", "100", "1000"}) + private int step; - @Benchmark - @Threads(28) - public long step_1(SegmentChainIdState segmentChainIdState) { - return segmentChainIdState.segmentId.generate(); - } + SegmentChainId segmentChainId; - @Benchmark - public long step_100(SegmentChainId100State segmentChainId100State) { - return segmentChainId100State.segmentId.generate(); + @Setup + public void setup() { + segmentChainId = RedisIdFactory.INSTANCE.createSegmentChainId(step); } @Benchmark - public long step_1000(SegmentChainId1000State segmentChainId1000State) { - return segmentChainId1000State.segmentId.generate(); + public long generate() { + return segmentChainId.generate(); } + @TearDown + public void tearDown() { + RedisIdFactory.INSTANCE.close(); + } } diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisIdBenchmark.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisIdBenchmark.java index 77da448d40..41f506faa1 100644 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisIdBenchmark.java +++ b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/RedisIdBenchmark.java @@ -13,30 +13,32 @@ package me.ahoo.cosid.redis; -import me.ahoo.cosid.redis.state.SegmentId1000State; -import me.ahoo.cosid.redis.state.SegmentId100State; -import me.ahoo.cosid.redis.state.SegmentIdState; +import me.ahoo.cosid.segment.SegmentId; import org.openjdk.jmh.annotations.*; /** * @author ahoo wang */ +@State(Scope.Benchmark) public class RedisIdBenchmark { - @Benchmark - @Threads(28) - public long step_1(SegmentIdState segmentIdState) { - return segmentIdState.segmentId.generate(); - } + @Param({"1", "100", "1000"}) + private int step; - @Benchmark - public long step_100(SegmentId100State segmentId100State) { - return segmentId100State.segmentId.generate(); + SegmentId segmentId; + + @Setup + public void setup() { + segmentId = RedisIdFactory.INSTANCE.createSegmentId(step); } @Benchmark - public long step_1000(SegmentId1000State segmentId1000State) { - return segmentId1000State.segmentId.generate(); + public long generate() { + return segmentId.generate(); } + @TearDown + public void tearDown() { + RedisIdFactory.INSTANCE.close(); + } } diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/JdkIdState.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/JdkIdState.java deleted file mode 100644 index 22bd66604c..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/JdkIdState.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.jvm.AtomicLongGenerator; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class JdkIdState { - - public AtomicLongGenerator jdkId; - - @Setup - public void setup() { - jdkId = new AtomicLongGenerator(); - } -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId1000State.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId1000State.java deleted file mode 100644 index f6675bb19f..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId1000State.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.redis.RedisIdFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentChainId1000State { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = RedisIdFactory.INSTANCE.createSegmentChainId(1000); - } - - @TearDown - public void tearDown() { - RedisIdFactory.INSTANCE.close(); - } -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId100State.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId100State.java deleted file mode 100644 index 5519d77494..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainId100State.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.redis.RedisIdFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentChainId100State { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = RedisIdFactory.INSTANCE.createSegmentChainId(100); - } - - @TearDown - public void tearDown() { - RedisIdFactory.INSTANCE.close(); - } -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainIdState.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainIdState.java deleted file mode 100644 index b08c0f7779..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentChainIdState.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.redis.RedisIdFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentChainIdState { - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = RedisIdFactory.INSTANCE.createSegmentChainId(1); - } - - @TearDown - public void tearDown() { - RedisIdFactory.INSTANCE.close(); - } -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId1000State.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId1000State.java deleted file mode 100644 index 7ed9edbb0d..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId1000State.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.redis.RedisIdFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentId1000State { - - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = RedisIdFactory.INSTANCE.createSegmentId(1000); - } - - @TearDown - public void tearDown() { - RedisIdFactory.INSTANCE.close(); - } -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId100State.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId100State.java deleted file mode 100644 index fb6d4fac2c..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentId100State.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.redis.RedisIdFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentId100State { - - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = RedisIdFactory.INSTANCE.createSegmentId(100); - } - - @TearDown - public void tearDown() { - RedisIdFactory.INSTANCE.close(); - } -} diff --git a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentIdState.java b/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentIdState.java deleted file mode 100644 index b3ca9089b0..0000000000 --- a/cosid-redis/src/jmh/java/me/ahoo/cosid/redis/state/SegmentIdState.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright [2021-2021] [ahoo wang (https://github.com/Ahoo-Wang)]. - * Licensed 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 me.ahoo.cosid.redis.state; - -import me.ahoo.cosid.redis.RedisIdFactory; -import me.ahoo.cosid.segment.SegmentId; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; - -/** - * @author ahoo wang - */ -@State(Scope.Benchmark) -public class SegmentIdState { - - public SegmentId segmentId; - - @Setup - public void setup() { - segmentId = RedisIdFactory.INSTANCE.createSegmentId(1); - } - - @TearDown - public void tearDown() { - RedisIdFactory.INSTANCE.close(); - } -} diff --git a/document/deploy.sh b/document/deploy.sh index aa27da0b12..97bac095a0 100755 --- a/document/deploy.sh +++ b/document/deploy.sh @@ -33,6 +33,6 @@ git commit -m 'deploy' # git push -f git@github.com:/.github.io.git master # 如果发布到 https://.github.io/ - git push -f git@github.com:Ahoo-Wang/CosId.git master:gh-pages +git push -f git@github.com:Ahoo-Wang/CosId.git master:gh-pages cd -