Comments (2)
Benchmark results before the changes:
Benchmark Mode Cnt Score Error Units
Throughput.compareTo thrpt 5 220079,691 ± 517,983 ops/ms
Throughput.equals thrpt 5 324611,500 ± 3358,493 ops/ms
Throughput.hashCode thrpt 5 419975,993 ± 4158,182 ops/ms
Benchmark results after the changes:
Benchmark Mode Cnt Score Error Units
Throughput.compareTo thrpt 5 354694,538 ± 10091,845 ops/ms (1.611667)
Throughput.equals thrpt 5 437656,101 ± 2504,245 ops/ms (1.348248)
Throughput.hashCode thrpt 5 459955,540 ± 4697,826 ops/ms (1.095196)
Benchmark code:
package benchmark;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import com.github.f4b6a3.tsid.Tsid;
import com.github.f4b6a3.tsid.TsidCreator;
@Fork(1)
@Threads(1)
@State(Scope.Benchmark)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 5, time = 3)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class Throughput {
Tsid tsid1 = new Tsid(0);
Tsid tsid2 = new Tsid(0);
@Benchmark
public int compareTo() {
return tsid1.compareTo(tsid2);
}
@Benchmark
public boolean equals() {
return tsid1.equals(tsid2);
}
@Benchmark
public int hashCode() {
return tsid1.hashCode();
}
}
from tsid-creator.
Released v5.0.1
from tsid-creator.
Related Issues (20)
- Version 4.0.0 HOT 2
- Provide OSGI support HOT 2
- Compare internal field as unsigned integers HOT 1
- Increment the counter when the random function returns null or empty HOT 1
- handle clock drift HOT 4
- Add support for RandomGenerator in Java 17 HOT 2
- Rewrite docs HOT 1
- Add a fast method to generate identifiers HOT 1
- Add the system property and environment variable to configure the node count HOT 1
- Add simple format methods HOT 1
- Make the Tsid class extensible HOT 1
- Suggestions for generating a node ID on Kubernetes HOT 7
- Question: Is the ThreadLocalRandom approach considerably safe on a clustered environment? HOT 5
- Reduce synchronization scope when generating the TSID HOT 5
- Fix sync HOT 1
- Using the Tsid.encode method in the JDK 8 environment HOT 3
- ArrayIndexOutOfBoundsException on input with multiple bytes for a character HOT 1
- TSID as database primary keys in multi tenant environment HOT 2
- Add benchmark code to compare TSID with UUID HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsid-creator.