---------------- English ----------------
This is an efficient concurrent toolkit, if one day, extraterrestrial civilization invades the earth, this toolkit may be an attempt by the software layer to fight against extraterrestrial civilization
usage method:
1:Import "EarthTech.jar" into the project
2:Run any of the following files
ArrayList_Test.java
LinkedList_Test.java
BlockingList_Test.java
Lock_Test.java
SpinLock_Test.java
Semaphore_Test.java
HashMap_Test.java
ThreadPool_Test.java
JDK 1.9 is required to run, and This package has concurrency performance that is not inferior to JDK Doug Lea JUC
performance:
class1 | class2 | result |
EarthTech.Lock | ReentrantLock | >10% |
EarthTech.SpinLock | X | >∞(Java does not have spinlock) |
EarthTech.ReentrantSpinLock | ReentrantLock | >30% |
EarthTech.RWLock | StampedLock | >∞(StampedLock is not secure) |
EarthTech.Semaphore | Semaphore | >10% |
EarthTech.ArrayList | CopyOnWriteArrayList | >50% |
EarthTech.LinkedList | ConcurrentLinkedQueue | >20% |
EarthTech.BlockingList | LinkedBlockingQueue | >5% |
EarthTech.HashMap | ConcurrentHashMap | >10% |
EarthTech.ThreadPool | ThreadPoolExecutor | >10% |
---------------- 中文 ----------------
这是一款高效的并发工具包, 如果某一天, 有地外文明侵犯地球, 此包的性能也许能派上用场
使用方式:
1:把 EarthTech.jar 导入到项目里
2:运行以下任意文件即可
ArrayList_Test.java //数组
LinkedList_Test.java //链表
BlockingList_Test.java //堵塞链表
Lock_Test.java //互斥锁
SpinLock_Test.java //自旋锁
Semaphore_Test.java //信号量
HashMap_Test.java //哈希表
ThreadPool_Test.java //线程池
需要jdk1.9才能运行,此包拥有不输 jdk Doug Lea JUC的并发性能。
性能对比:
类1 | 类2 | 结果 |
EarthTech.Lock | ReentrantLock | >10% |
EarthTech.SpinLock | X | >∞(java没有自旋锁) |
EarthTech.ReentrantSpinLock | ReentrantLock | >30% |
EarthTech.RWLock | StampedLock | >∞(StampedLock是不安全的) |
EarthTech.Semaphore | Semaphore | >10% |
EarthTech.ArrayList | CopyOnWriteArrayList | >50% |
EarthTech.LinkedList | ConcurrentLinkedQueue | >20% |
EarthTech.BlockingList | LinkedBlockingQueue | >5% |
EarthTech.HashMap | ConcurrentHashMap | >10% |
EarthTech.ThreadPool | ThreadPoolExecutor | >10% |